Linux内核内存管理算法Buddy和Slab: /proc/meminfo、/proc/buddyinfo、/proc/slabinfo

时间:2024-01-14 11:31:02

slabtop

cat /proc/slabinfo

# name            <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail>
ovl_inode 552 552 680 24 4 : tunables 0 0 0 : slabdata 23 23 0
ext4_groupinfo_4k 7440 7440 136 30 1 : tunables 0 0 0 : slabdata 248 248 0
RAWv6 104 104 1216 26 8 : tunables 0 0 0 : slabdata 4 4 0
UDPLITEv6 0 0 1216 26 8 : tunables 0 0 0 : slabdata 0 0 0
UDPv6 104 104 1216 26 8 : tunables 0 0 0 : slabdata 4 4 0
tw_sock_TCPv6 208 208 256 16 1 : tunables 0 0 0 : slabdata 13 13 0
TCPv6 452 570 2176 15 8 : tunables 0 0 0 : slabdata 38 38 0
cfq_queue 0 0 232 17 1 : tunables 0 0 0 : slabdata 0 0 0
bsg_cmd 0 0 312 26 2 : tunables 0 0 0 : slabdata 0 0 0
UDP-Lite 0 0 1088 30 8 : tunables 0 0 0 : slabdata 0 0 0
flow_cache 0 0 144 28 1 : tunables 0 0 0 : slabdata 0 0 0
xfrm_dst_cache 84 84 576 28 4 : tunables 0 0 0 : slabdata 3 3 0
UDP 180 180 1088 30 8 : tunables 0 0 0 : slabdata 6 6 0
tw_sock_TCP 176 176 256 16 1 : tunables 0 0 0 : slabdata 11 11 0
TCP 632 864 1984 16 8 : tunables 0 0 0 : slabdata 54 54 0

echo `cat /proc/slabinfo |awk 'BEGIN{sum=0;}{sum=sum+$3*$4;}END{print sum/1024/1024}'` MB

参考:

系统技术非业余研究:Linux Used内存到底哪里去了

Linux内核内存管理算法Buddy和Slab