3

I'm trying to set memory usage limits per user (256MB RAM, 64MB swap) using cgroups. I've looked into a few other questions on the topic (1, 2, 3), but can't figure out how to use cgroups properly.

Here's my /etc/cgconfig.conf (it was initially empty):

mount {
    cpuset = /cgroup/cpuset;
    cpu = /cgroup/cpu;
    cpuacct = /cgroup/cpuacct;
    memory = /cgroup/memory;
    devices = /cgroup/devices;
    freezer = /cgroup/freezer;
    net_cls = /cgroup/net_cls;
    blkio = /cgroup/blkio;
}

group memlimit { memory { memory.limit_in_bytes = 268435456; memory.memsw.limit_in_bytes = 67108864; } }

cgconfigparser -l /etc/cgconfig.conf returns this:

Error: cannot mount memory to /cgroup/memory: Device or resource busy
cgconfigparser; error loading /etc/cgconfig.conf: Cgroup mounting failed
luihum
  • 31
  • 2
    Don't know what the problem is. But keep in mind Ubuntu 22.04 is using cgroups v2 whereas most questions are probably geared the older cgroups v1. What works for one may not work for the other. – Daniel Oct 14 '22 at 11:35

0 Answers0