Explain how to use pagefault readaround to decrease the disk spinup frequency. --- 25-akpm/Documentation/laptop-mode.txt | 16 ++++++++++++++++ 1 files changed, 16 insertions(+) diff -puN Documentation/laptop-mode.txt~laptop-mode-readahead Documentation/laptop-mode.txt --- 25/Documentation/laptop-mode.txt~laptop-mode-readahead 2004-03-26 01:11:59.969132648 -0800 +++ 25-akpm/Documentation/laptop-mode.txt 2004-03-26 01:14:18.868016808 -0800 @@ -120,6 +120,18 @@ Tips & Tricks this on powerbooks too. I hope that this is a piece of information that might be useful to the Laptop Mode patch or it's users." +* One thing which will cause disks to spin up is not-present application + and dynamic library text pages. The kernel will load program text off disk + on-demand, so each time you invoke an application feature for the first + time, the kernel needs to spin the disk up to go and fetch that part of the + application. + + So it is useful to increase the disk readahead parameter greatly, so that + the kernel will pull all of the executable's pages into memory on the first + pagefault. + + The supplied script does this. + Control script -------------- @@ -180,6 +192,8 @@ DIRTY_RATIO=40 # DIRTY_BACKGROUND_RATIO=5 +READAHEAD=4096 # kilobytes + # kernel default dirty buffer age DEF_AGE=30 DEF_UPDATE=5 @@ -222,6 +236,7 @@ case "$1" in "reiserfs") mount $DEV -t $FST $MP -o remount,$PARSEDOPTS,commit=$MAX_AGE,noatime ;; "xfs") mount $DEV -t $FST $MP -o remount,$PARSEDOPTS,commit=$MAX_AGE,noatime ;; esac + blockdev --setra $((READAHEAD * 2)) $DEV done fi echo "." @@ -251,6 +266,7 @@ case "$1" in "reiserfs") mount $DEV -t $FST $MP -o remount,$PARSEDOPTS ;; "xfs") mount $DEV -t $FST $MP -o remount,$PARSEDOPTS ;; esac + blockdev --setra 256 $DEV done fi echo "." _