|
Description
|
I've spotted a couple of problems which waste a lot of time during "gentle" system shutdown, at least on fast systems. This does not pertain to the amount of time it takes to do "poweroff" or "reboot", but rather "shutdown" or "init [056]"
1) The function smf_kill_contract() in /lib/svc/share/smf_include.sh is miscoded, and will always sleep for at least 5 seconds, regardless of how quickly the contract empties (in my tests, the contract is nearly always empty within 100ms of the kill). This introduces long idle periods into the shutdown process, at least on fast systems. On a stock system, three such periods happen during every shutdown.
2) startd spends fully 15 seconds waiting for /usr/sbin/killall(1m), including 10 seconds waiting for the results of killall -9 to complete. This is too long, and happens on all systems. killall isn't nearly as impactful as the name might sound: it merely looks through /etc/utmpx for LOGIN_PROCESS and USER_PROCESS entries, and kills those.
3) The ppp shutdown script (a legacy RC script) sleeps for one second every time it runs. Since all legacy scripts run before any other stop methods, this induces a delay on all systems, regardless of whether ppp is in use.
4) shutdown(1m) calls sync(1m) at the start of shutdown (curiously, it calls sync before the grace period even begins!)
5) rc0/rc5/rc6 calls sync; sync; sync even though it's run near the beginning of shutdown, rather than at the end.
Fixing these problems reduced the amount of time reduced the amount of time to shutdown on my desktop from 50 seconds to 8.
|