-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
meminfo: Add slab_reclaimable to MemAvailable #671
Conversation
Signed-off-by: Asain Kujovic <[email protected]>
@@ -1389,7 +1398,8 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset, | |||
snprintf(lbuf, 100, "MemFree: %8" PRIu64 " kB\n", memlimit - memusage); | |||
printme = lbuf; | |||
} else if (startswith(line, "MemAvailable:")) { | |||
snprintf(lbuf, 100, "MemAvailable: %8" PRIu64 " kB\n", memlimit - memusage + (mstat.total_active_file + mstat.total_inactive_file) / 1024); | |||
snprintf(lbuf, 100, "MemAvailable: %8" PRIu64 " kB\n", memlimit - memusage + | |||
(mstat.total_active_file + mstat.total_inactive_file + mstat.slab_reclaimable) / 1024); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this approach is good enough. For reference: https://github.com/torvalds/linux/blob/13563da6ffcf49b8b45772e40b35f96926a7ee1e/mm/show_mem.c#L64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR as it is should be better option than current situation. And I still proposing it as it will solve mentioned issue.
So solution (3) is still better than (2) and currently best option, so I am still proposing this PR as it is, as a needed solution. We are not including kern_reclaimable but also do not spliting sreclaimable by half, so that estimation good as we do not have all source values that host's kernel has. Thanks for the review and approval. |
This PR proposal is created for the problem explained at issue 670
Slab-Reclaimable memory in any system should not be part of "used" but oposite, should be part of "available" memory.
So like said in issue, I am not an expert about all details of memory values, but hope that someone of lxcfs creators can confirm that this is logical needed change.
Kernel send us 'memory.current' file for the cgroup we are inside, witch we (lxcfs code) use it as base 'memused' value.
For calculating MemAvailable we subtracting memused from memorymax, and already we are adding to it total_active/inactive_file values as reclaimable ones. Slab-reclaimable should be added here too (or we will have unreal growth of memory, like explained in connected issue)