]>
Commit | Line | Data |
---|---|---|
f955d3a9 WB |
1 | From 8a0e1fd9d0c8866af5947ab2acee0c28e8827573 Mon Sep 17 00:00:00 2001 |
2 | From: Christian Brauner <christian.brauner@ubuntu.com> | |
3 | Date: Tue, 3 Nov 2020 22:27:05 +0100 | |
4 | Subject: [PATCH lxcfs 1/8] meminfo: show host swap values when no limit or | |
5 | equal limits are set | |
6 | ||
7 | Closes: #434 | |
8 | Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> | |
9 | --- | |
10 | src/proc_fuse.c | 12 +++++++++++- | |
11 | 1 file changed, 11 insertions(+), 1 deletion(-) | |
12 | ||
13 | diff --git a/src/proc_fuse.c b/src/proc_fuse.c | |
14 | index 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 | -- | |
37 | 2.20.1 | |
38 |