「Linux」- 内存管理

限制内存的使用

TODO 限制内存的使用(Linux)
Restricting process CPU usage using nice, cpulimit, and cgroups

/proc/slabinfo

/proc/meminfo 仅显示 Slab 的整体大小,具体到每一种 Slab 缓存,还要查看 /proc/slabinfo 文件:

$ cat /proc/slabinfo | grep -E '^#|dentry|inode'
# name            <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail>
xfs_inode              0      0    960   17    4 : tunables    0    0    0 : slabdata      0      0      0
...
ext4_inode_cache   32104  34590   1088   15    4 : tunables    0    0    0 : slabdata   2306   2306      0hugetlbfs_inode_cache     13     13    624   13    2 : tunables    0    0    0 : slabdata      1      1      0
sock_inode_cache    1190   1242    704   23    4 : tunables    0    0    0 : slabdata     54     54      0
shmem_inode_cache   1622   2139    712   23    4 : tunables    0    0    0 : slabdata     93     93      0
proc_inode_cache    3560   4080    680   12    2 : tunables    0    0    0 : slabdata    340    340      0
inode_cache        25172  25818    608   13    2 : tunables    0    0    0 : slabdata   1986   1986      0
dentry             76050 121296    192   21    1 : tunables    0    0    0 : slabdata   5776   5776      0

// dentry 行表示目录项缓存
// inode_cache 行,表示 VFS 索引节点缓存
// 其余的则是各种文件系统的索引节点缓存,查询 man slabinfo 手册