]> git.proxmox.com Git - mirror_lxcfs.git/commit
proc_fuse: improve swap calculation
authorStéphane Graber <stgraber@ubuntu.com>
Fri, 17 Apr 2020 19:59:53 +0000 (21:59 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Fri, 17 Apr 2020 20:13:53 +0000 (16:13 -0400)
commitbbccb89cb91db968f04737d72233d852ff621100
tree0381d5f4cc1f79830ff703bf9701873f330212af
parentd24c05b5eee7ba11474e77fd120372d857362f27
proc_fuse: improve swap calculation

Stéphane has been running into issues with wrong sawp limits. The logic
he suggested does:
- if memory == memory+swap, we list both at the memlimit for total size
- if memory+swap is larger than memory, then we add the extra amount to
  total swap but still cap to physical swap limit

We came to the conclusion that this is currently the best approach as we
show the mem limit as both Memory and Swap so advertising twice as much
as allowed but there's no way around that really or we'd need to
dynamically update both MemTotal and SwapTotal based on what's used to
keep MemTotal+SwapTotal == limit that's certainly doable but it will be
somewhat racy and also likely confused userspace more than mis-reporting
swap.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/proc_fuse.c