1. /proc/sys/fs/dentry-state


[root@localhost /]# cat /proc/sys/fs/dentry-state 
1005427 1000315 45      0       0       0

2. 理解分析

dentry缓存的目的,为了减少对慢速磁盘的访问,每当VFS文件系统对底层的数据进行访问时,都会将访问的结果缓存下来,保存成一个dentry对象。

而且dentry对象的组织与管理,是和inode缓存极其相似的,也有一个hash表,和一个lru队列。

而且当内存压力较大时,也会调用prune_dcache来企图释放lru中优先级较低的dentry项目。

3. 翻译

这个文件包含目录缓存(dcache)状态信息。这个文件包含6个数字,nr_dentry,nr_unused,age_limit,wang_pages还有两个保留未使用的值。

  • nr_dentry 是已经分配的目录项。这个字段在Linux2.2时还未使用。

  • nr_unused 是未使用的目录项数量。

  • age_limit 当内存紧缺时,延迟多少秒后会回收目录项

  • wang_pages 当内核调用shrink_dcache_pages()函数并且dcache没有pruned时这个值是非0的。


/proc/sys/fs/dentry-state (since Linux 2.2)

This file contains information about the status of the directory cache (dcache). The file contains six numbers, nr_dentry, nr_unused, age_limit (age in seconds), want_pages (pages requested by system) and two dummy values.

  • nr_dentry is the number of allocated dentries (dcache entries). This field is unused in Linux 2.2.

  • nr_unused is the number of unused dentries.

  • age_limit is the age in seconds after which dcache entries can be reclaimed when memory is short.

  • want_pages is non-zero when the kernel has called shrink_dcache_pages() and the dcache isn't pruned yet.

Copyright © 温玉 2021 | 浙ICP备2020032454号 all right reserved,powered by Gitbook该文件修订时间: 2023-06-19 08:59:50

results matching ""

    No results matching ""