I have a Debian 10 server and I am trying to limit the memory + swap of a user using cgroups2.
Using memory.limit_in_bytes
works fine, but I want to limit the memory+swap using memory.memsw.limit_in_bytes
which isn't working.
I get this error when I run cgconfigparser
:
root@server:~# cgconfigparser -l /etc/cgconfig.conf
Error: failed to set /sys/fs/cgroup/memory/group1/memory.memsw.limit_in_bytes: Invalid argument
cgconfigparser; error loading /etc/cgconfig.conf: Failed to remove a non-empty group
root@server:~#
Here is the group:
group group1 {
memory {
memory.memsw.limit_in_bytes = 512m;
}
}
Any idea on what's wrong?
EDIT: I've enabled cgroups memory and swapaccount in the GRUB command already but still the issue occurs.
cat /proc/cmdline
please? Apart from that, try as mentioned in this answer: https://unix.stackexchange.com/a/125024/83329 – doktor5000 Apr 12 '20 at 09:18root@server:~# cat /proc/cmdline BOOT_IMAGE=/boot/vmlinuz-5.4.0-0.bpo.2-amd64 root=/dev/sda2 ro rd.driver=raid1,ahci,dm_mod,part_gpt domdadm dolvm rd.lvm.vg=vg00 rd.lvm.lv=vg00/usr console=ttyS0,57600 console=tty0 net.ifnames=0 biosdevname=0 quiet cgroup_enable=memory swapaccount=1
– Mario Apr 12 '20 at 09:29memory.max
andmemory.swap.max
@ChrisDown good catch ;) – doktor5000 Apr 12 '20 at 12:09cgroup_no_v1=all
on the kernel command line. – Chris Down Apr 12 '20 at 12:12