simple task to speed up booting

Ian Lepore ian at freebsd.org
Mon Dec 22 05:05:47 UTC 2014


On Sun, 2014-12-14 at 10:32 +0000, Poul-Henning Kamp wrote:
> The rotating swirlie ('-/|\') in the loader accounts for a surprisingly
> large part of our boot time on systems with slow-ish serial consoles.
> 
> I think right now it takes a step for each 512 byte read, reducing that
> to once every 64kB or even 1MB would be an improvement with the kind of
> kernel sizes we have today.
> 

I investigated this a bit today.  I instrumented the loader on arm to
count how many times twiddle() is called while loading a 5.5MB kernel.
When loading over NFS it was called 5580 times.  When loading from an
sdcard it was called 284 times.

Poking around in the code, it looks like NFS calls twiddle() once per 1K
block read, CD9660 once per 2K block, and UFS and ext2fs once per
filesystem blocksize block.  All of them have some other scattered
twiddle calls while navigating metadata that probably don't add up to
much compared to the bulk reading.

My amd64 kernel is twice as big even with lots of the generic devices
removed; that's a lot of IO.  But one twiddle per filesystem block
shouldn't be so bad... let's call it 600 twiddles, each one writes 2
bytes to serial, so a total of ~1200mS at 9600bps.  The same kernel
loaded over nfs would cost over 20 seconds in serial output.

So all in all it seems like different kinds of IO need different
throttling, something like the attached (which also still has some stats
output in it).  I can't decide if it's worth committing... it'll have a
lot of value to someone with slow serial and netbooting, is that common?

-- Ian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: twiddle_divisors.diff
Type: text/x-patch
Size: 9534 bytes
Desc: 
URL: <http://lists.freebsd.org/pipermail/freebsd-current/attachments/20141221/fcbb2b1f/attachment.bin>


More information about the freebsd-current mailing list