Clearing page caches in Linux
Brian France pointed this out to me, it's useful stuff, particularly when benchmarking I/O.
To free pagecache:
- echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
- echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
- echo 3 > /proc/sys/vm/drop_caches
It's a good idea to sync first, to assure that all dirty page caches are dropped.