You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
memory: Avoid estimating available memory, use kernel estimate instead
`free`, `btop` and other tools (like the `sysinfo` rust library)
use `mem_total - mem_avail` to calculate the used memory. As explained
in the already linked [kernel commit][1], `mem_avail` is an estimate of
the available memory based on the current way the kernel handles
memory.
The previous logic for calculating used memory tried to estimate
this based on `mem_free`, `buffers`, `pagecache` and
`reclaimable`. Unfortunately, as the kernel commit message predicts,
this user space estimate bitrots, as the kernel memory usage patterns change.
Thus, we now simply use the kernel estimate `mem_avail` as we know that
that is in-sync with the relevant kernel internals.
[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773
0 commit comments