[SOLVED] LXC swap incorrect

dik23

Member
Apr 3, 2011
98
0
6
My containers are not obeying their allocated swap. For example container 111 has been allocated 128MB swap.

Code:
arch: amd64
cores: 1
cpulimit: 1
cpuunits: 100
hostname: XXX
memory: 2048
net0: name=eth0,bridge=vmbr0,gw=10.0.0.1,hwaddr=36:1F:BC:1B:78:47,ip=10.0.0.111/32,type=veth
ostype: ubuntu
parent: snap
rootfs: zfs:subvol-111-disk-1,size=4G
swap: 128
unprivileged: 1
Screenshot from 2018-04-30 13-29-16.png
However htop shows

Screenshot from 2018-04-30 13-32-46.png

as does top

top.png

This is true for all my LXC

pveversion -v

Code:
proxmox-ve: 5.1-42 (running kernel: 4.13.16-2-pve)
pve-manager: 5.1-51 (running version: 5.1-51/96be5354)
pve-kernel-4.13: 5.1-44
pve-kernel-4.13.16-2-pve: 4.13.16-47
pve-kernel-4.13.16-1-pve: 4.13.16-46
corosync: 2.4.2-pve4
criu: 2.11.1-1~bpo90
glusterfs-client: 3.8.8-1
ksm-control-daemon: 1.2-2
libjs-extjs: 6.0.1-2
libpve-access-control: 5.0-8
libpve-apiclient-perl: 2.0-4
libpve-common-perl: 5.0-30
libpve-guest-common-perl: 2.0-14
libpve-http-server-perl: 2.0-8
libpve-storage-perl: 5.0-18
libqb0: 1.0.1-1
lvm2: 2.02.168-pve6
lxc-pve: 3.0.0-2
lxcfs: 3.0.0-1
novnc-pve: 0.6-4
proxmox-widget-toolkit: 1.0-15
pve-cluster: 5.0-25
pve-container: 2.0-22
pve-docs: 5.1-17
pve-firewall: 3.0-8
pve-firmware: 2.0-4
pve-ha-manager: 2.0-5
pve-i18n: 1.0-4
pve-libspice-server1: 0.12.8-3
pve-qemu-kvm: 2.11.1-5
pve-xtermjs: 1.0-2
pve-zsync: 1.6-15
qemu-server: 5.0-25
smartmontools: 6.5+svn4324-1
spiceterm: 3.0-5
vncterm: 1.5-3
zfsutils-linux: 0.7.7-pve1~bpo9
 
Last edited:

fabian

Proxmox Staff Member
Staff member
Jan 7, 2016
3,399
529
113
it's technically correct (the best kind after all ;)) since cgroups (in their currently used form) don't have a notion of separate swap. there is one limit for memory, and one for memory+swap combined. but of course this is confusing, as the values no suggest a total memory of (in your case) 2G + 2G + 128M, while in reality every used bit of swap also counts as used bit of memory in the container, and the total memory is only 2G + 128M.

we are currently discussing whether to revert this again or not.
 

wbumiller

Proxmox Staff Member
Staff member
Jun 23, 2015
645
84
28
It'll get more confusing in the future - cgroup v2 separated memory and swap ;-) (then again the adoption of that is going about as fast as the adoption of ipv6...)
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE 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 your own in 60 seconds.

Buy now!