build initramfs: logging is slow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commenting out this line from inst_simple:
    ddebug "Installing $_src"
saves me about 10% real time (not counting final gzip) in build initramfs.

The low-level culprit is the extra _process_ [fork or clone] for $(_lvl2char ...) in:
----- dracut-logger
_do_dlog() {
    [ -z "$maxloglvl" ] && return 0
    local lvl="$1"; shift
    local lvlc=$(_lvl2char "$lvl") || return 0    ### SLOW!

    [ $lvl -le $maxloglvl ] || return 0
-----

Instead, the level translation should be done using an indexed array
(after an arithmetic check for index-out-of-range.)

Even better, the level comparison should be hoisted into the definition
of ddebug and dtrace, such as:
-----
ddebug() {
    [ 5 -le $maxloglvl ] || return 0
    set +x
    dlog 5 "$@"
}
-----

If bash could conditionally re-define a function, then dlog_init might:
    [ 5 -le $maxloglvl ]  ||  eval "function ddebug() {}"
but that did not work for me.

-- 
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux