LXC swap size change/regression between PVE 6.3 minor versions

kobuki

Renowned Member
Dec 30, 2008
474
28
93
I've just upgraded a server to PVE 6.3 (pve-manager/6.3-3/eee5f901 (running kernel: 5.4.78-2-pve)) and see a sudden change in how LXC swap amount is presented. For a long time in older versions in LXC (maybe starting with 4.x) the swap size was shown and calculated as RAM+swap, but thankfully the 6.x series went back to the correct, old interpretation that shows and counts swap and RAM separately (likely because of cgroup changes). However the latest PVE 6.3 version again shows swap in LXC as RAM+swap.

Examples below.

Correct swap size (config is RAM: 8GB, swap: 2GB):
Code:
# pveversion
pve-manager/6.2-15/48bd51b6 (running kernel: 5.4.73-1-pve)
# pct enter 733
# free -h
             total       used       free     shared    buffers     cached
Mem:          8.0G       5.2G       2.8G        22M         0B       2.2G
-/+ buffers/cache:       3.0G       5.0G
Swap:         2.0G        20M       2.0G

Incorrect swap size (config is RAM: 512MB, swap: 256MB):
Code:
# pveversion
pve-manager/6.3-3/eee5f901 (running kernel: 5.4.78-2-pve)
# pct enter 741
# free -h
              total        used        free      shared  buff/cache   available
Mem:          512Mi        44Mi       434Mi       8.0Mi        32Mi       467Mi
Swap:         768Mi          0B       768Mi

How can I change it back to the correct calculation method above? Is that possible at all? Is it a regression (a bug) in PVE 6.x? Any hints are greatly appreciated. It currently causes issues with monitoring and some of our automation tools.

EDIT: just checked another PVE host with the same latest (6.3-3/eee5f901) version as above and it shows the correct interpretation of RAM and swap. Weird.

EDIT2: the change in swap interpretation happened between lxcfs versions 4.0.3-pve3 and 4.0.6-pve1. Just checked that a PVE 6.3 + lxcfs 4.0.3-pve3 shows the correct swap interpretation (consistent with LXC CT settings, nothing gets added to RAM size).
 
Last edited:
Apparently, this is the way it should be with cgroup v1. Cgroup v2 is supposed to show swap separately again but it's not active in PVE right now. It's unexplained why it was shown correctly (separately, as it should be in v2) in earlier 6.x versions. It's a mess, anyway. See also here.
 
  • Like
Reactions: vn0cer

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!