On 09/24/13 13:52, Gary Artim wrote:
i did the following to setup a cgroup, but when I test "it" doesn't kill the pid, anyone get this working? must be missing something...program mallocs 32GB...much thanks for advise!
::install::
yum install libcgroup-tools libcgroup
::config::
cd /sys/fs/cgroup/memory mkdir alpha echo 4096000000 > alpha/memory.limit_in_bytes cat alpha/memory.limit_in_bytes change /etc/cgrules.conf add line: @users memory alpha/ start: cgrulesengd
::test::
check if pid is in alpha/tasks: cat /sys/fs/cgroup/memory/alpa/tasks run: cat > memlimit.c <<"END" #include <stdlib.h> #include <stdio.h> #define ONEGB 1073741824 int main(void) { int i; for (i=0; i < 32; i++) { char *q = malloc(ONEGB); printf ("Malloced: %d / GB\n", (i+1)); } sleep(9999999); } END gcc memlimit.c && ./a.out
Did you "man systemd.cgroup"? Do you have to do something to turn memory accounting on to make this work (perhaps i n/etc/cgrules.conf)? Have you tried setting up a.out as a service with the appropriate MemoryLimit=bytes and/or MemorySoftLimit=bytes settings set and then tried to run it as a service?
Kevin