Bug 77141
Summary: | MemFree can be higher than MemAvailable | ||
---|---|---|---|
Product: | Memory Management | Reporter: | sworddragon2 |
Component: | Other | Assignee: | Andrew Morton (akpm) |
Status: | RESOLVED INVALID | ||
Severity: | normal | CC: | riel |
Priority: | P1 | ||
Hardware: | x86-64 | ||
OS: | Linux | ||
Kernel Version: | 3.15.0-rc7 | Subsystem: | |
Regression: | No | Bisected commit-id: |
Description
sworddragon2
2014-05-29 19:43:57 UTC
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. |