On Sat, 2007-21-07 at 23:00 +0200, Peter Zijlstra wrote: > Use the read-ahead code to provide hints to page reclaim. > > This patch has the potential to solve the streaming-IO trashes my > desktop problem. > > It tries to aggressively reclaim pages that were loaded in a strong > sequential pattern and have been consumed. Thereby limiting the damage > to the current resident set. > > Signed-off-by: Peter Zijlstra (sorry for the delay) Ok, I've done some tests with your patches, I came up with a test program that should approximate my use case. It simply mmap() and scan (read) a 375M file which represent the usual used memory on my desktop system. This data is frequently used, and should stay cached as much as possible in preference over the "used once" data read in the page cache when copying large files. I don't claim that the test program is perfect or even correct, I'm open for suggestions. Test system: - Linux x86_64 2.6.23-rc1 - 1G of RAM - I use the basic drop behind and sysctl patches. The readahead size patch is _not_ included. Setting up: dd if=/dev/zero of=/tmp/375M_file bs=1M count=375 dd if=/dev/zero of=/tmp/5G_file bs=1M count=5120 Tests with stock kernel (drop behind disabled): echo 0 >/proc/sys/vm/drop_behind Base test: sync; echo 1 >/proc/sys/vm/drop_caches time ./large_app_load_simul /tmp/375M_file time ./large_app_load_simul /tmp/375M_file time ./large_app_load_simul /tmp/375M_file time ./large_app_load_simul /tmp/375M_file 1st execution: 0m7.146s 2nd execution: 0m1.119s 3rd execution: 0m1.109s 4th execution: 0m1.105s Reading a large file test: sync; echo 1 >/proc/sys/vm/drop_caches time ./large_app_load_simul /tmp/375M_file time ./large_app_load_simul /tmp/375M_file cp /tmp/5G_file /dev/null time ./large_app_load_simul /tmp/375M_file time ./large_app_load_simul /tmp/375M_file 1st execution: 0m7.224s 2nd execution: 0m1.114s 3rd execution: 0m7.178s <<< Much slower 4th execution: 0m1.115s Copying (read+write) a large file test: sync; echo 1 >/proc/sys/vm/drop_caches time ./large_app_load_simul /tmp/375M_file time ./large_app_load_simul /tmp/375M_file cp /tmp/5G_file /tmp/copy_of_5G_file time ./large_app_load_simul /tmp/375M_file time ./large_app_load_simul /tmp/375M_file rm /tmp/copy_of_5G_file 1st execution: 0m7.203s 2nd execution: 0m1.147s 3rd execution: 0m7.238s <<< Much slower 4th execution: 0m1.129s Tests with drop behind enabled: echo 1 >/proc/sys/vm/drop_behind Base test: [same tests as above] 1st execution: 0m7.206s 2nd execution: 0m1.110s 3rd execution: 0m1.102s 4th execution: 0m1.106s Reading a large file test: [same tests as above] 1st execution: 0m7.197s 2nd execution: 0m1.116s 3rd execution: 0m1.114s <<< Great!!! 4th execution: 0m1.111s Copying (read+write) a large file test: [same tests as above] 1st execution: 0m7.186s 2nd execution: 0m1.111s 3rd execution: 0m7.339s <<< Not fixed 4th execution: 0m1.121s Conclusion: - The drop-behind patch works and really prevents the page cache content from being fulled with useless read-once data. - It doesn't help the copy (read+write) case. This should also be fixed, as it's a common workload. Tested-By: Eric St-Laurent (ericstl34@xxxxxxxxx.xx) Best regards, - Eric (*) Test program and batch file are attached.