最近我注意到,从 /proc/meminfo 和 /proc/<pid> 读取的监控脚本显示了奇怪的读数,似乎缺少了几百 MB。htop 显示了相同的差异:
CPU: 36.9% sys: 7.6% low: 0.0% Tasks: 123; 1 running
Mem:1750M used:1568M buffers:20M cache:87M Load average: 0.90 1.33 1.33
Swp:1787M used:184M Uptime: 1 day, 00:28:22
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
3455 rena 20 0 1221M 312M 20464 S 14.0 17.8 1h20:26 /usr/lib/firefox/firefox
1428 root 20 0 327M 100M 6236 S 7.0 5.7 1h28:52 /usr/bin/X :0 -auth /var/run/lightdm/root/:0 -nol
14012 rena 20 0 630M 26400 5264 S 0.0 1.5 0:14.20 /usr/bin/python /usr/bin/sonata --toggle
2562 rena 20 0 914M 21100 10904 S 0.0 1.2 3:59.50 xfce4-terminal --role "Terminal" --hide-menubar -
2492 rena 20 0 379M 20528 3312 S 0.0 1.1 0:03.53 pcmanfm --desktop --profile lubuntu
使用的内存为 1568M,但前 5 个进程并未使用接近该内存的内存:312+100+26+21+20+20(缓冲区)+87(缓存)= 586M。那么982M在某个地方丢失了吗?
操作系统是 Lubuntu 12.04 AMD64。
内容/proc/meminfo
:
MemTotal: 1792540 kB
MemFree: 67824 kB
Buffers: 17084 kB
Cached: 109624 kB
SwapCached: 69600 kB
Active: 436880 kB
Inactive: 245756 kB
Active(anon): 402348 kB
Inactive(anon): 169616 kB
Active(file): 34532 kB
Inactive(file): 76140 kB
Unevictable: 13456 kB
Mlocked: 13456 kB
SwapTotal: 1830908 kB
SwapFree: 1632380 kB
Dirty: 40 kB
Writeback: 0 kB
AnonPages: 515492 kB
Mapped: 46852 kB
Shmem: 3308 kB
Slab: 875752 kB
SReclaimable: 19108 kB
SUnreclaim: 856644 kB
KernelStack: 2688 kB
PageTables: 19468 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 2727176 kB
Committed_AS: 1741500 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 285612 kB
VmallocChunk: 34359436336 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 1551232 kB
DirectMap2M: 282624 kB
板头(按尺寸):
Active / Total Objects (% used) : 1859056 / 1873931 (99.2%)
Active / Total Slabs (% used) : 115960 / 115960 (100.0%)
Active / Total Caches (% used) : 76 / 108 (70.4%)
Active / Total Size (% used) : 906258.20K / 909988.65K (99.6%)
Minimum / Average / Maximum Object : 0.01K / 0.49K / 8.00K
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
1640475 1640475 100% 0.53K 109365 15 874920K idr_layer_cache
4941 4628 93% 0.86K 549 9 4392K ext4_inode_cache
19068 13243 69% 0.19K 908 21 3632K dentry
6034 5325 88% 0.55K 431 14 3448K inode_cache
20272 20272 100% 0.14K 724 28 2896K sysfs_dir_cache
答案1
这似乎是启动板上已确认的错误。它也影响我的系统。
https://bugs.launchpad.net/ubuntu/+source/nfs-utils/+bug/1047566
答案2
这可能是由于页面缓存。如果是这样的话,强制内核删除页面缓存将释放大量内存。
# echo 1 > /proc/sys/vm/drop_caches