3 simple steps to make booting/shutdown faster...

Arjan van de Ven arjan at infradead.org
Sun Feb 17 16:15:20 UTC 2008


On Sun, 17 Feb 2008 07:04:11 -0500
Behdad Esfahbod <behdad at behdad.org> wrote:

> On Sat, 2008-02-16 at 18:40 -0800, Arjan van de Ven wrote: 
> > So I got a tad annoyed by why the initscript processing is (in my
> > impatient perception) slow; most initscripts (in timing) only take
> > like 0.1 second themselves after all. Turns out.. the rest of the
> > initscript system had quite a bit of overhead. (More so on F7 than
> > on F8, but still).
> > 
> > Now... I made a bunch of tweaks to the 3 key files and this made
> > things quite a bit faster; F8 is 50% slower than the new situation 
> > (for a specific test, new code takes 0.275 seconds, F8 code takes
> > 0.41 seconds).
> > 
> > What I changed:
> > * if you do if [ -f FOO -o -f BAR ] in bash, bash will look to see
> > if BOTH files exist, and then decides that since FOO exits,
> > everything is fine and executes the if body. Looking for
> > non-existing files (first time) is expensive.. so splitting this
> > kind of "if" in two reduces disk seeks and IO. [this kind of split
> > I had to do in a few places]
> 
> This should really be fixed in bash to short-circuit.

well......... not sure it can be done in the bash language.
(it may well guarantee that both get executed)


> 
> 
> > * Don't let the initscripts change the VGA font; after all, this is
> > done during early boot already. Programming the VGA fonts is SLOW.
> > (Note: in F7 this was done for each init script, in F8 things were
> > a tad, but not much, smarter than that)
> 
> I'd go as far as saying that unicode_start should only be called
> from /etc/profile, not other bash invocations.
> 
> I have a hard time imagining why you hit it at all though, as only
> interactive bash should run bashrc which in turn calls
> into /etc/profile.d, or am I missing something?

you're missing that /etc/profile.d/lang.sh is used from many places ;(


> Many moons ago I tried to reduce startup time on my fedora too.  I
> spent most time on rc.sysinit though.  There's a lot that can be
> optimized there.  I used bootchart to guide my search.  In the end I
> came up with a short rc.behdad file that I could pass as init to
> kernel (!) which would bring up just enough services to start gdm and
> then pass control to /sbin/init.  And I reached something like 10
> seconds from grub to gdm.  I know there's a reason for every line of
> rc.sysinit, but a huge lot of it can be optimized or postponed.

I suppose so; my laptop has a nice SSD so no seek times, could do even better.

> 
> There were some plain silly bits.  For example look
> at /sbin/start_udev. It implements a simple xargs in shell.  I

udev is a different story entirely. It's so incredibly slow that it's just outrageous.
The Linux distro that came with my laptop took less time from hitting the power button
to full desktop login completed than Fedora takes in the udev step alone.
*sad*.
On my compile box at work, udev takes about one minute to start
*more sad*



-- 
If you want to reach me at my work email, use arjan at linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org




More information about the devel mailing list