The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxcfs/pull/435

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Closes: #434
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
From 6da2a084789ed0122cacde5ee950cb9689daf7c4 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brau...@ubuntu.com>
Date: Tue, 3 Nov 2020 22:27:05 +0100
Subject: [PATCH] meminfo: show host swap values when no limit or equal limits
 are set

Closes: #434
Signed-off-by: Christian Brauner <christian.brau...@ubuntu.com>
---
 src/proc_fuse.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/proc_fuse.c b/src/proc_fuse.c
index 907f5c7..7bc1eb0 100644
--- a/src/proc_fuse.c
+++ b/src/proc_fuse.c
@@ -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;
                                }
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to