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