]> 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)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 17 Apr 2020 20:02:53 +0000 (22:02 +0200)
commit89662777a34fc3b275713d89f5ce3d5e2641ea73
tree9b7a5815828b8a6e2021a3c7e2b8bbe6a1208b25
parent0117bcdee97987d27208da0406462bd47494562c
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