I want to use libcgroup Tools to write cgconfig.conf and cgrules.conf files to limit the maximum memory usage of different users, but it has no effect. I repeatedly restarted cgconfig and cgrid, but it didn't work. in cgconfig.conf:
group users_mem_limit{
memory{
memory.limit_in_bytes = 1G;
memory.memsw.limit_in_bytes = 1G;
}
}
template users/%u {
memory {
memory.limit_in_bytes = 2G;
memory.memsw.limit_in_bytes = 2G;
}
}
in cgrules.conf:
user1 memory users_mem_limit/
* memory,cpu users/%u
I repeatedly restarted the cgconfig and cgrid services, but there was no response. My virtual machine has a maximum memory limit of 7GB, but my stress test will not return an error on 3G, only on 7GB or above. Even if I use the wrong user, I should still report an error on 3G. I don't understand where the problem lies
stress -m 1 --vm-bytes 3G -t 2