FS#24689 - [initscripts] optimize kernel cmdline parsing
Attached to Project:
Arch Linux
Opened by Matthias Dienstbier (fs4000) - Saturday, 11 June 2011, 15:26 GMT
Last edited by Tom Gundersen (tomegun) - Sunday, 12 June 2011, 20:36 GMT
Opened by Matthias Dienstbier (fs4000) - Saturday, 11 June 2011, 15:26 GMT
Last edited by Tom Gundersen (tomegun) - Sunday, 12 June 2011, 20:36 GMT
|
Details
Currently we do this to check for forcefsck:
for cmdarg in $(< /proc/cmdline); do [[ "$cmdarg" == forcefsck ]] && FORCEFSCK="-- -f" && break done shouldn't this do almost the same but easier: if grep -qw forcefsck /proc/cmdline; then FORCEFSCK="-- -f" fi The only problem might be, that grep also returns true for something like "forcefsck=no" as it treats '=' as a non-word constituent character. |
This task depends upon
Closed by Tom Gundersen (tomegun)
Sunday, 12 June 2011, 20:36 GMT
Reason for closing: None
Additional comments about closing: Asked for patch.
Sunday, 12 June 2011, 20:36 GMT
Reason for closing: None
Additional comments about closing: Asked for patch.
Comment by Jan de Groot (JGC) -
Sunday, 12 June 2011, 09:48 GMT
Your change adds a call to grep, which is an external binary.
Launching external binaries takes some overhead that might be
bigger than what you're trying to optimize.
Comment by Tom Gundersen (tomegun) -
Sunday, 12 June 2011, 20:36 GMT
Jan is probably right. However, if you want people to comment on
this, then submit a patch to
arch-projects@archlinux.org.