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
prefetched.
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
future.
However, room for improvement is quite small, as you can see on this
bootchart:
http://prefetch.googlecode.com/svn/trunk/results/boot-prefetching/testmachine-kl1/test-9-versus-plain/bootchart-prefetch-sync.png
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:
http://code.google.com/p/prefetch/wiki/InitialBootPrefetchingResults
Of course there is always room for improvements. This implementation of
prefetch is just the beginning :)
Thanks for insightful comments.
Krzysztof Lichota
signature.asc
Description: OpenPGP digital signature
--
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at:
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss