htop
htop copied to clipboard
Read kernel's "MemAvailable" if possible
Recent kernel versions support "MemAvailable" in /proc/meminfo which provides more accurate information on the amount of memory available. therefore we can now deduce:
usedmem = totalmem - MemAvailable;
See also https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773
I have made some tests with MemAvailable and got a strange result: https://bugzilla.kernel.org/show_bug.cgi?id=77141
The ticket is now finished and confirms that MemAvailable is not suitable to calculate the used memory. But I have opened another ticket as feature request to get such an entry in /proc/meminfo: https://bugzilla.kernel.org/show_bug.cgi?id=78741 In case it should get closed (as they don't like feature requests in the tracker) htop could keep the current behavior or try to get all related values for a more precise calculation from other entries in /proc.
FYI: procps (free
command) is going to support MemAvailable.
https://gitorious.org/procps/procps/commit/ba6396f886f1a9911221e1c7c4b66dc75acb6948