So, here's a funny one - a 2 second sleep on shutdown for no apparent reason Looking through sysvinit source code src/halt.c ~line 266: if (do_sync) { sync(); sleep(2); } do_sync is set by default unless -n is in options Looking at /etc/inittab: l0s:0:wait:/sbin/halt -dhp Not setting -n So, the interactions is quite stupid: * mount-ro mounts things as readonly * mount-ro calls sync anyway * as far as I can tell (please correct me if wrong) sync is a synchronous system call, thus no need to sleep after it Comparative timings of a KVM test instance: Default: [ 2.729372] reboot: Power down l0s:0:wait:/sbin/halt -dhpn [ 0.707627] reboot: Power down So, out of the *WHOLE* boot time we waste 2/3ds in a needless sleep!
I guess sysvinit maintainers might be interested too - could be patched in sysvinit easily
(In reply to Patrick Lauer from comment #0) > * as far as I can tell (please correct me if wrong) sync is a synchronous > system call, thus no need to sleep after it This is what IEEE Std 1003.1, 2004 Edition (aka POSIX) says: DESCRIPTION The sync() function shall cause all information in memory that updates file systems to be scheduled for writing out to all file systems. The writing, although scheduled, is not necessarily complete upon return from sync(). Linux may be stricter, but isn't OpenRC supposed to be portable?
Yes, OpenRC is meant to be portable. Exactly what change are you requesting -- adding -n to the options or a patch for sysvinit?
I think the sleep(2) is needlessly pessimistic, so changing that might be discussed. But more importantly, as we already run mount-ro (unless users remove it) there's no reason to do a sync() at this point again, and even less reason to sleep randomly. (So at this point all FSes are readonly, or something went seriously wrong and sync() doesn't help anyway) Thus I would recommend adding the "-n" to inittab.
Same change for the reboot case (which sleep(1)'s - that is inconsistent!) -l6r:6:wait:/sbin/reboot -dk +l6r:6:wait:/sbin/reboot -dkn
@base-system: Both changes being proposed here actually apply to the sysvinit package since it owns /etc/inittab, so I need some insight from the rest of you. How do you feel about these changes? William
there's a lot of historical baggage in there woods
(In reply to SpanKY from comment #7) > there's a lot of historical baggage in there woods So it might be the right time to cut down some trees.
This is fixed in 2.88-r8. Thanks for the report. :-)