当前位置:首页 > Linux > 正文内容

如何释放pagecache、inodes、dentries

sa2022-04-10Linux

内核文档链接:https://www.kernel.org/doc/html/latest/admin-guide/sysctl/vm.html

内核文档对drop_caches的解释:

Writing to this will cause the kernel to drop clean caches, as well as reclaimable slab objects like dentries and inodes. Once dropped, their memory becomes free.

image.png

释放页面缓存(pagecache)

To free pagecache:

# echo 1 > /proc/sys/vm/drop_caches

# sudo sysctl -w vm.drop_caches=1

释放文件的数据结构目录的数据结构(分别指inodedentries

To free dentries and inodes:

# echo 2 > /proc/sys/vm/drop_caches

# sudo sysctl -w vm.drop_caches=2

释放文件数据结构、目录数据结构和页面缓存

To free pagecache, dentries and inodes:

# echo 3 > /proc/sys/vm/drop_caches

# sudo sysctl -w vm.drop_caches=3


其它参考链接:

https://unix.stackexchange.com/questions/87908/how-do-you-empty-the-buffers-and-cache-on-a-linux-system

https://stackoverflow.com/questions/29870068/what-are-pagecache-dentries-inodes

https://www.linuxatemyram.com/

版权声明:本文由老瓦罐儿煨汤发布,如需转载请注明出处。

本文链接:https://zhangchen.cc/?id=30

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。