I have seen the commit about MemAvailable ( https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773 ) and have made some tests with it. From the description MemAvailable should be MemFree with adding the parts of the cache, etc. which are claimable which also means that MemAvailable should always be higher than MemFree. Here is how it normally looks: root@ubuntu:~# cat /proc/meminfo | grep -E 'MemFree|MemAvailable|Buffers|^Cached|file|SReclaimable' MemFree: 14949536 kB MemAvailable: 15519900 kB Buffers: 194092 kB Cached: 344588 kB Active(file): 207768 kB Inactive(file): 328528 kB SReclaimable: 287484 kB But in some cases after dropping the cache and checking /proc/meminfo MemAvailable is lower than MemFree which seems to be impossible: root@ubuntu:~# echo 3 > /proc/sys/vm/drop_caches root@ubuntu:~# cat /proc/meminfo | grep -E 'MemFree|MemAvailable|Buffers|^Cached|file|SReclaimable' MemFree: 15660144 kB MemAvailable: 15643972 kB Buffers: 876 kB Cached: 124020 kB Active(file): 22328 kB Inactive(file): 100060 kB SReclaimable: 14208 kB
Not all free memory is available to userspace allocations. Below a certain threshold only the kernel is allowed to do memory allocations, and allocations below that threshold will drive the system to swapping. In /proc/zoneinfo you can see the different free watermarks for your system. On my system it looks like this: Node 0, zone DMA pages free 3970 min 10 low 12 high 15 Node 0, zone DMA32 pages free 70301 min 2443 low 3053 high 3664 Node 0, zone DMA32 pages free 70301 min 2443 low 3053 high 3664 The MemAvailable number only goes down to the low watermark at most, since allocations below that will cause swapping. If you add the sum of the low watermarks to MemAvailable, you should get a value larger than MemFree.
Btw, the numbers in /proc/zoneinfo are in pages, so you need to multiply them by 4 to get kilobytes.
If I'm understanding this correctly that means MemAvailable should be taken literally: It shows how many memory is available but it isn't suitable to calculate how many memory is already in use due to the threshold (basically MemTotal - MemAvailable would be wrong).
Indeed, MemAvailable is an estimate of how much memory you can allocate without the system going into swap. It is (free memory - system reserve) + (part of page cache) + (part of buffer cache) + (part of reclaimable slab)
Thanks for the explanation, I'm marking this ticket as invalid then.