Announcement: Kernel with automatic boot tracing and prefetching available for testing (GSoC 2007)

Krzysztof Lichota krzysiek at
Tue Aug 14 13:46:06 UTC 2007

Phillip Susi napisał(a):
> Krzysztof Lichota wrote:
>> How it works?
>> - During boot file accesses are recorded.
>> - During subsequent boots this trace is used to prefetch files before
>> they are used in order to speed up boot.
> How is the data prefetched?  I know that the readahead package used the
> readahead() system call to load entire files that were accessed during
> boot.  This is sub optimal because often times the entire file is not
> needed, only certain pages of it.  

Prefetch works on page-size chunks, so only used parts of files are

As for reading, prefetch uses force_page_cache_readahead(), so it is the
same function as used by readahead() call.

> Also the readahead was done
> synchronously one file at a time, which does not keep the disk at full
> utilization.  Ideally you just want to read in the required pages, in
> the order in which they are required, with several asynchronous requests
> in the queue at a time.  

This is good idea, it might improve results a bit. I will try it in the
However, room for improvement is quite small, as you can see on this

During readahead disk is almost 100% utilized.

> You also want to wait until some of the data is
> read before continuing with the boot process, but you don't want to wait
> until ALL of it is read.

It depends. I have done some experiments with asynchronous prefetching
and in most cases it is better to wait for readahead to finish before
proceeding than to let readahead go in parallel with execution of apps.
This is consistent with results of other prefetching systems.

The exception is when you can prefetch some files in advance, before
execution of apps starts. This approach is used in prefetch to prefetch
GUI in advance. The boot is split into 3 phases:
1. boot - since root partition is mounted until all filesystems are mounted
2. system - when all partitions are mounted till KDM/GDM is started
3. gui - when desktop environment is started

Each phase is traced separately. For boot and system phase files are
prefetched synchronously at start of the phase, but GUI phase files are
prefetched in background right after system phase files are prefetched.

I have done quite a lot of experiments to find the proper combination of
parameters. See the page with descriptions of experiments:

Of course there is always room for improvements. This implementation of
prefetch is just the beginning :)

Thanks for insightful comments.

	Krzysztof Lichota

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Ubuntu-devel-discuss mailing list