0
$ 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

How can MemAvailable be this high on my system?

When I read the kernel code, I thought we could approximate MemAvailable with a formula like MemFree + (Buffers + Cached - Shmem)/2 + SReclaimable/2. So I would have guessed MemAvailable would be more like 1.8G.

I don't think the 0.8G difference is due to the Reclaimable Slabs part, because I only have 100M of them:

$ 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
2

This is how MemAvailable is calculated. You’d have to subtract the low watermarks from /proc/zoneinfo, but your available memory isn’t surprising; adding MemFree, Active(file), Inactive(file) and SReclaimable gives 3012956 KiB.

  • but the file and SReclaimable terms effectively get divided by 2, no? – sourcejedi Feb 13 at 14:31
  • 1
    No, they don’t. They are only divided by two if they are smaller than double the low watermarks, which is unusual — most of the time the low watermarks are significantly less than half the page cache and reclaimable swap. – Stephen Kitt Feb 13 at 14:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.