我正在调查系统中的内存问题。以下是/proc/meminfo
:
$ cat /proc/meminfo
MemTotal: 32869176 kB
MemFree: 1495144 kB
Buffers: 15052 kB
Cached: 123904 kB
SwapCached: 37404 kB
Active: 1411400 kB
Inactive: 759904 kB
Active(anon): 1369796 kB
Inactive(anon): 663364 kB
Active(file): 41604 kB
Inactive(file): 96540 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 64802808 kB
SwapFree: 64083052 kB
Dirty: 164 kB
Writeback: 0 kB
AnonPages: 1264272 kB
Mapped: 23940 kB
Shmem: 656 kB
Slab: 508344 kB
SReclaimable: 35888 kB
SUnreclaim: 472456 kB
KernelStack: 2952 kB
PageTables: 16256 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 81237396 kB
Committed_AS: 3424480 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 557636 kB
VmallocChunk: 34359169020 kB
HardwareCorrupted: 0 kB
AnonHugePages: 28672 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 32502180 kB
DirectMap2M: 972800 kB
DirectMap1G: 0 kB
将 MemFree 一直加到 Inactive(file) 大约占 MemTotal 的 10%。Free 显示我的大部分 RAM 已被使用:
$ free -t
total used free shared buffers cached
Mem: 32869176 31403960 1465216 0 23504 135372
-/+ buffers/cache: 31245084 1624092
Swap: 64802808 719692 64083116
Total: 97671984 32123652 65548332
但排名前 10 的 RSS 流程还远远不够:
$ grep VmRSS /proc/*/status | sort -k2 -h | tail -n 10
/proc/26526/status:VmRSS: 9272 kB
/proc/30731/status:VmRSS: 10772 kB
/proc/27143/status:VmRSS: 29816 kB
/proc/25802/status:VmRSS: 31156 kB
/proc/20750/status:VmRSS: 38972 kB
/proc/15231/status:VmRSS: 40932 kB
/proc/25511/status:VmRSS: 62140 kB
/proc/25519/status:VmRSS: 116836 kB
/proc/1747/status:VmRSS: 277516 kB
/proc/24658/status:VmRSS: 648960 kB
我的 RAM 去哪儿了?