2

Is it possible to limit memory usage per user not per group?

This is my config ...

/etc/cgconfig.conf

mount {
    cpu     = /cgroup/cpu_and_mem;
    cpuacct = /cgroup/cpu_and_mem;
    memory  = /cgroup/cpu_and_mem;
}
group small {
        cpu {
                cpu.shares="100";
        }
        cpuacct {
                cpuacct.usage="0";
        }
        memory {
                memory.limit_in_bytes="200M";
                memory.memsw.limit_in_bytes="200M";
        }
}

/etc/cgrules.conf

@guests      cpu,cpuacct,memory      small
user1        cpu,cpuacct,memory      small
user2        cpu,cpuacct,memory      small

Right now i see only one option to create group small1 and link user1 to that group, then user2 to small2 and so on, like this:

/etc/cgconfig.conf

group small1 {
        cpu {
                cpu.shares="100";
...
group small2 {
        cpu {
                cpu.shares="100";
...

/etc/cgrules.conf

user1        cpu,cpuacct,memory      small1
user2        cpu,cpuacct,memory      small2

Does anybody know better way of doing this?

Abc Xyz
  • 608
  • 1
  • 8
  • 16

1 Answers1

3

Is it possible to limit memory usage per user not per group?

It is possible with templates

Rules specified in /etc/cgrules.conf can be linked to templates configured either in the /etc/cgconfig.conf file or in configuration files stored in the /etc/cgconfig.d/ directory, allowing for flexible cgroup assignment and creation.

Abc Xyz
  • 608
  • 1
  • 8
  • 16