$ free -h
total used free shared buff/cache available
Mem: 7.7Gi 4.5Gi 692Mi 305Mi 2.5Gi 2.6Gi
Swap: 2.0Gi 25Mi 2.0Gi
MemAvailable
我的系统怎么会这么高?
当我阅读时内核代码,我想我们可以MemAvailable
用类似的公式进行近似MemFree + (Buffers + Cached - Shmem)/2 + SReclaimable/2
。所以我猜测 MemAvailable 会更像 1.8G。
我不认为 0.8G 的差异是由于 Reclaimable Slabs 部分造成的,因为我只有 100M:
$ grep SReclaimable /proc/meminfo
SReclaimable: 106492 kB
$ uname -r
4.20.3-200.fc29.x86_64
$ cat /proc/meminfo
MemTotal: 8042592 kB
MemFree: 708864 kB
MemAvailable: 2740432 kB
Buffers: 225472 kB
Cached: 2289436 kB
SwapCached: 1768 kB
Active: 4367844 kB
Inactive: 2538636 kB
Active(anon): 3443868 kB
Inactive(anon): 1265012 kB
Active(file): 923976 kB
Inactive(file): 1273624 kB
Unevictable: 11528 kB
Mlocked: 11528 kB
SwapTotal: 2097148 kB
SwapFree: 2071412 kB
Dirty: 80 kB
Writeback: 44 kB
AnonPages: 4402684 kB
Mapped: 554452 kB
Shmem: 313044 kB
KReclaimable: 106492 kB
Slab: 249164 kB
SReclaimable: 106492 kB
SUnreclaim: 142672 kB
KernelStack: 17888 kB
PageTables: 37020 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 6118444 kB
Committed_AS: 12077056 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
Percpu: 2688 kB
HardwareCorrupted: 0 kB
AnonHugePages: 2160640 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
DirectMap4k: 297524 kB
DirectMap2M: 7968768 kB
DirectMap1G: 1048576 kB
答案1
这是如何MemAvailable
计算的。您必须从 中减去低水位线/proc/zoneinfo
,但您的可用内存不足为奇;添加MemFree
、Active(file)
、Inactive(file)
并SReclaimable
给出 3012956 KiB。