本文主要参考的内核文档:https://www.kernel.org/doc/Documentation/sysctl/vm.txt
drop_caches
============================================================== 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. To free pagecache: echo 1 > /proc/sys/vm/drop_caches To free reclaimable slab objects (includes dentries and inodes): echo 2 > /proc/sys/vm/drop_caches To free slab objects and pagecache: echo 3 > /proc/sys/vm/drop_caches This is a non-destructive operation and will not free any dirty objects. To increase the number of objects freed by this operation, the user may run `sync' prior to writing to /proc/sys/vm/drop_caches. This will minimize the number of dirty objects on the system and create more

本文详细介绍了Linux系统中`drop_caches`的使用,包括如何删除clean pagecache和reclaimable slab,并探讨了pagecache(磁盘文件缓存)和slab(内核对象缓存)的概念。`drop_caches`操作是瞬时且非破坏性的,但可能会导致性能问题。同时,文章提到了内存管理的LRU算法、kswapd内核线程和pdflush刷脏页机制。
最低0.47元/天 解锁文章
918

被折叠的 条评论
为什么被折叠?



