计算机技术

关闭/清除Linux缓存

Sometimes, we have such a situation happening with droping the OS cache. We may usually tell the OS to use direct io or unbuffered reads and writes. How to drop the OS caches?
To use /proc/sys/vm/drop_caches, just echo a number to it.
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
This is a non-destructive operation and will only free things that are completely unused. Dirty objects will continue to be in use until written out to disk and are not freeable.  

Related Articles

发表回复

Check Also
Close
Back to top button