[PATCH] vars.sh: remove unnecessary fork to speedup boot/upgrades

Trek trek00 at inbox.ru
Mon Aug 31 20:36:42 BST 2020


On Mon, 31 Aug 2020 20:30:49 +0200 (CEST)
Thorsten Glaser <t.glaser at tarent.de> wrote:

> Please keep using cat for Linux procfs; reading it from the
> shell is broken for many entries (/proc/cmdline isn’t one of
> them, but others are:
> 
> 	https://bugzilla.kernel.org/show_bug.cgi?id=209031

oh, many thanks for the pointer, I wasn't aware of it!

however reading from /proc/cmdline should be well tested in Debian, for
example inside dracut, since squeeze at least:

  https://sources.debian.org/src/dracut/005-1/modules.d/99base/init/#L262


> Furthermore, read is slower because it has to read byte for
> byte, whereas cat can read in larger blocks. The fork is not
> nice but at least one of the shells eligible for /bin/sh has
> cat as builtin, so there’s that.

right, reading one byte at time is slower than reading a memory page at
once, but the clone+execve syscalls are even slower

the default shell, /bin/dash, does not have cat as builtin and this
results in 10% more time needed to execute the script

anyway I'm not a fan of fast boot&upgrades and the fancy output
(enabled by default) makes scripts at least 2x slower, so a 10% gain is
not much when it's 100% slower for other issues :)

ciao!



More information about the Debian-init-diversity mailing list