htop icon indicating copy to clipboard operation
htop copied to clipboard

Read kernel's "MemAvailable" if possible

Open crrodriguez opened this issue 10 years ago • 4 comments

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;

crrodriguez avatar May 19 '14 22:05 crrodriguez

See also https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773

crrodriguez avatar May 19 '14 22:05 crrodriguez

I have made some tests with MemAvailable and got a strange result: https://bugzilla.kernel.org/show_bug.cgi?id=77141

Sworddragon avatar May 29 '14 19:05 Sworddragon

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.

Sworddragon avatar Jun 23 '14 01:06 Sworddragon

FYI: procps (free command) is going to support MemAvailable. https://gitorious.org/procps/procps/commit/ba6396f886f1a9911221e1c7c4b66dc75acb6948

ypresto avatar Dec 19 '14 12:12 ypresto