]> git.proxmox.com Git - lxcfs.git/blame - debian/patches/pve/0001-meminfo-show-host-swap-values-when-no-limit-or-equal.patch
d/copyright: reflect that now all is licensed under LGPL-2.1+
[lxcfs.git] / debian / patches / pve / 0001-meminfo-show-host-swap-values-when-no-limit-or-equal.patch
CommitLineData
f955d3a9
WB
1From 8a0e1fd9d0c8866af5947ab2acee0c28e8827573 Mon Sep 17 00:00:00 2001
2From: Christian Brauner <christian.brauner@ubuntu.com>
3Date: Tue, 3 Nov 2020 22:27:05 +0100
4Subject: [PATCH lxcfs 1/8] meminfo: show host swap values when no limit or
5 equal limits are set
6
7Closes: #434
8Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
9---
10 src/proc_fuse.c | 12 +++++++++++-
11 1 file changed, 11 insertions(+), 1 deletion(-)
12
13diff --git a/src/proc_fuse.c b/src/proc_fuse.c
14index 907f5c7..7bc1eb0 100644
15--- a/src/proc_fuse.c
16+++ b/src/proc_fuse.c
17@@ -1243,7 +1243,17 @@ static int proc_meminfo_read(char *buf, size_t size, off_t offset,
18
19 sscanf(line + STRLITERALLEN("SwapTotal:"), "%" PRIu64, &hostswtotal);
20
21- if (hostswtotal < swtotal) {
22+ /*
23+ * If swtotal is 0 it should mean that
24+ * memory.memsw.limit_in_bytes and
25+ * memory.limit_in_bytes are both unlimited or
26+ * both set to the same value. In both cases we
27+ * have no idea what the technical swap limit
28+ * is supposed to be (It's a shared limit
29+ * anyway.) so fallback to the host's values in
30+ * that case too.
31+ */
32+ if ((hostswtotal < swtotal) || swtotal == 0) {
33 swtotal = hostswtotal;
34 host_swap = true;
35 }
36--
372.20.1
38