Skip to content
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: show host swap values when no limit or equal limits are set #435

Merged
merged 1 commit into from
Nov 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/proc_fuse.c
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,17 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,

sscanf(line + STRLITERALLEN("SwapTotal:"), "%" PRIu64, &hostswtotal);

if (hostswtotal < swtotal) {
/*
* If swtotal is 0 it should mean that
* memory.memsw.limit_in_bytes and
* memory.limit_in_bytes are both unlimited or
* both set to the same value. In both cases we
* have no idea what the technical swap limit
* is supposed to be (It's a shared limit
* anyway.) so fallback to the host's values in
* that case too.
*/
if ((hostswtotal < swtotal) || swtotal == 0) {
swtotal = hostswtotal;
host_swap = true;
}
Expand Down