• Home
  • Raw
  • Download

Lines Matching refs:cgroup

29 static int cg_check_frozen(const char *cgroup, bool frozen)  in cg_check_frozen()  argument
32 if (cg_read_strstr(cgroup, "cgroup.events", "frozen 1") != 0) { in cg_check_frozen()
33 debug("Cgroup %s isn't frozen\n", cgroup); in cg_check_frozen()
40 if (cg_read_strstr(cgroup, "cgroup.events", "frozen 0") != 0) { in cg_check_frozen()
41 debug("Cgroup %s is frozen\n", cgroup); in cg_check_frozen()
52 static int cg_freeze_nowait(const char *cgroup, bool freeze) in cg_freeze_nowait() argument
54 return cg_write(cgroup, "cgroup.freeze", freeze ? "1" : "0"); in cg_freeze_nowait()
60 static int cg_prepare_for_wait(const char *cgroup) in cg_prepare_for_wait() argument
70 ret = inotify_add_watch(fd, cg_control(cgroup, "cgroup.events"), in cg_prepare_for_wait()
116 static int cg_enter_and_wait_for_frozen(const char *cgroup, int pid, in cg_enter_and_wait_for_frozen() argument
122 fd = cg_prepare_for_wait(cgroup); in cg_enter_and_wait_for_frozen()
126 ret = cg_enter(cgroup, pid); in cg_enter_and_wait_for_frozen()
135 ret = cg_check_frozen(cgroup, frozen); in cg_enter_and_wait_for_frozen()
150 static int cg_freeze_wait(const char *cgroup, bool freeze) in cg_freeze_wait() argument
154 fd = cg_prepare_for_wait(cgroup); in cg_freeze_wait()
158 ret = cg_freeze_nowait(cgroup, freeze); in cg_freeze_wait()
168 ret = cg_check_frozen(cgroup, freeze); in cg_freeze_wait()
178 static int child_fn(const char *cgroup, void *arg) in child_fn() argument
196 char *cgroup = NULL; in test_cgfreezer_simple() local
199 cgroup = cg_name(root, "cg_test_simple"); in test_cgfreezer_simple()
200 if (!cgroup) in test_cgfreezer_simple()
203 if (cg_create(cgroup)) in test_cgfreezer_simple()
207 cg_run_nowait(cgroup, child_fn, NULL); in test_cgfreezer_simple()
209 if (cg_wait_for_proc_count(cgroup, 100)) in test_cgfreezer_simple()
212 if (cg_check_frozen(cgroup, false)) in test_cgfreezer_simple()
215 if (cg_freeze_wait(cgroup, true)) in test_cgfreezer_simple()
218 if (cg_freeze_wait(cgroup, false)) in test_cgfreezer_simple()
224 if (cgroup) in test_cgfreezer_simple()
225 cg_destroy(cgroup); in test_cgfreezer_simple()
226 free(cgroup); in test_cgfreezer_simple()
247 char *cgroup[10] = {0}; in test_cgfreezer_tree() local
251 cgroup[0] = cg_name(root, "cg_test_tree_A"); in test_cgfreezer_tree()
252 if (!cgroup[0]) in test_cgfreezer_tree()
255 cgroup[1] = cg_name(cgroup[0], "B"); in test_cgfreezer_tree()
256 if (!cgroup[1]) in test_cgfreezer_tree()
259 cgroup[2] = cg_name(cgroup[1], "C"); in test_cgfreezer_tree()
260 if (!cgroup[2]) in test_cgfreezer_tree()
263 cgroup[3] = cg_name(cgroup[1], "D"); in test_cgfreezer_tree()
264 if (!cgroup[3]) in test_cgfreezer_tree()
267 cgroup[4] = cg_name(cgroup[0], "E"); in test_cgfreezer_tree()
268 if (!cgroup[4]) in test_cgfreezer_tree()
271 cgroup[5] = cg_name(cgroup[4], "F"); in test_cgfreezer_tree()
272 if (!cgroup[5]) in test_cgfreezer_tree()
275 cgroup[6] = cg_name(cgroup[5], "G"); in test_cgfreezer_tree()
276 if (!cgroup[6]) in test_cgfreezer_tree()
279 cgroup[7] = cg_name(cgroup[6], "H"); in test_cgfreezer_tree()
280 if (!cgroup[7]) in test_cgfreezer_tree()
283 cgroup[8] = cg_name(cgroup[0], "I"); in test_cgfreezer_tree()
284 if (!cgroup[8]) in test_cgfreezer_tree()
287 cgroup[9] = cg_name(cgroup[0], "K"); in test_cgfreezer_tree()
288 if (!cgroup[9]) in test_cgfreezer_tree()
292 if (cg_create(cgroup[i])) in test_cgfreezer_tree()
295 cg_run_nowait(cgroup[2], child_fn, NULL); in test_cgfreezer_tree()
296 cg_run_nowait(cgroup[7], child_fn, NULL); in test_cgfreezer_tree()
297 cg_run_nowait(cgroup[9], child_fn, NULL); in test_cgfreezer_tree()
298 cg_run_nowait(cgroup[9], child_fn, NULL); in test_cgfreezer_tree()
299 cg_run_nowait(cgroup[9], child_fn, NULL); in test_cgfreezer_tree()
306 if (cg_wait_for_proc_count(cgroup[2], 1) || in test_cgfreezer_tree()
307 cg_wait_for_proc_count(cgroup[7], 1) || in test_cgfreezer_tree()
308 cg_wait_for_proc_count(cgroup[9], 3)) in test_cgfreezer_tree()
314 if (cg_freeze_wait(cgroup[1], true)) in test_cgfreezer_tree()
320 if (cg_freeze_wait(cgroup[5], true)) in test_cgfreezer_tree()
326 if (cg_freeze_wait(cgroup[6], true)) in test_cgfreezer_tree()
332 if (cg_check_frozen(cgroup[0], false)) in test_cgfreezer_tree()
335 if (cg_check_frozen(cgroup[4], false)) in test_cgfreezer_tree()
341 if (cg_freeze_wait(cgroup[0], true)) in test_cgfreezer_tree()
344 if (cg_check_frozen(cgroup[1], true)) in test_cgfreezer_tree()
347 if (cg_check_frozen(cgroup[4], true)) in test_cgfreezer_tree()
353 if (cg_freeze_nowait(cgroup[1], false)) in test_cgfreezer_tree()
356 if (cg_freeze_nowait(cgroup[5], false)) in test_cgfreezer_tree()
359 if (cg_freeze_nowait(cgroup[6], false)) in test_cgfreezer_tree()
365 if (cg_check_frozen(cgroup[2], true)) in test_cgfreezer_tree()
368 if (cg_check_frozen(cgroup[7], true)) in test_cgfreezer_tree()
374 if (cg_freeze_wait(cgroup[0], false)) in test_cgfreezer_tree()
377 if (cg_check_frozen(cgroup[2], false)) in test_cgfreezer_tree()
380 if (cg_check_frozen(cgroup[9], false)) in test_cgfreezer_tree()
386 for (i = 9; i >= 0 && cgroup[i]; i--) { in test_cgfreezer_tree()
387 cg_destroy(cgroup[i]); in test_cgfreezer_tree()
388 free(cgroup[i]); in test_cgfreezer_tree()
397 static int forkbomb_fn(const char *cgroup, void *arg) in forkbomb_fn() argument
420 char *cgroup = NULL; in test_cgfreezer_forkbomb() local
422 cgroup = cg_name(root, "cg_forkbomb_test"); in test_cgfreezer_forkbomb()
423 if (!cgroup) in test_cgfreezer_forkbomb()
426 if (cg_create(cgroup)) in test_cgfreezer_forkbomb()
429 cg_run_nowait(cgroup, forkbomb_fn, NULL); in test_cgfreezer_forkbomb()
433 if (cg_freeze_wait(cgroup, true)) in test_cgfreezer_forkbomb()
436 if (cg_killall(cgroup)) in test_cgfreezer_forkbomb()
439 if (cg_wait_for_proc_count(cgroup, 0)) in test_cgfreezer_forkbomb()
445 if (cgroup) in test_cgfreezer_forkbomb()
446 cg_destroy(cgroup); in test_cgfreezer_forkbomb()
447 free(cgroup); in test_cgfreezer_forkbomb()
568 char *cgroup[2] = {0}; in test_cgfreezer_migrate() local
571 cgroup[0] = cg_name(root, "cg_test_migrate_A"); in test_cgfreezer_migrate()
572 if (!cgroup[0]) in test_cgfreezer_migrate()
575 cgroup[1] = cg_name(root, "cg_test_migrate_B"); in test_cgfreezer_migrate()
576 if (!cgroup[1]) in test_cgfreezer_migrate()
579 if (cg_create(cgroup[0])) in test_cgfreezer_migrate()
582 if (cg_create(cgroup[1])) in test_cgfreezer_migrate()
585 pid = cg_run_nowait(cgroup[0], child_fn, NULL); in test_cgfreezer_migrate()
589 if (cg_wait_for_proc_count(cgroup[0], 1)) in test_cgfreezer_migrate()
595 if (cg_freeze_wait(cgroup[1], true)) in test_cgfreezer_migrate()
598 if (cg_enter_and_wait_for_frozen(cgroup[1], pid, true)) in test_cgfreezer_migrate()
601 if (cg_check_frozen(cgroup[0], false)) in test_cgfreezer_migrate()
607 if (cg_enter_and_wait_for_frozen(cgroup[0], pid, false)) in test_cgfreezer_migrate()
610 if (cg_check_frozen(cgroup[1], true)) in test_cgfreezer_migrate()
616 if (cg_freeze_wait(cgroup[0], true)) in test_cgfreezer_migrate()
619 if (cg_enter_and_wait_for_frozen(cgroup[1], pid, true)) in test_cgfreezer_migrate()
622 if (cg_check_frozen(cgroup[0], true)) in test_cgfreezer_migrate()
628 if (cgroup[0]) in test_cgfreezer_migrate()
629 cg_destroy(cgroup[0]); in test_cgfreezer_migrate()
630 free(cgroup[0]); in test_cgfreezer_migrate()
631 if (cgroup[1]) in test_cgfreezer_migrate()
632 cg_destroy(cgroup[1]); in test_cgfreezer_migrate()
633 free(cgroup[1]); in test_cgfreezer_migrate()
643 char *cgroup = NULL; in test_cgfreezer_ptrace() local
647 cgroup = cg_name(root, "cg_test_ptrace"); in test_cgfreezer_ptrace()
648 if (!cgroup) in test_cgfreezer_ptrace()
651 if (cg_create(cgroup)) in test_cgfreezer_ptrace()
654 pid = cg_run_nowait(cgroup, child_fn, NULL); in test_cgfreezer_ptrace()
658 if (cg_wait_for_proc_count(cgroup, 1)) in test_cgfreezer_ptrace()
661 if (cg_freeze_wait(cgroup, true)) in test_cgfreezer_ptrace()
676 if (cg_check_frozen(cgroup, true)) in test_cgfreezer_ptrace()
685 if (cg_check_frozen(cgroup, true)) in test_cgfreezer_ptrace()
691 if (cgroup) in test_cgfreezer_ptrace()
692 cg_destroy(cgroup); in test_cgfreezer_ptrace()
693 free(cgroup); in test_cgfreezer_ptrace()
725 char *cgroup = NULL; in test_cgfreezer_stopped() local
727 cgroup = cg_name(root, "cg_test_stopped"); in test_cgfreezer_stopped()
728 if (!cgroup) in test_cgfreezer_stopped()
731 if (cg_create(cgroup)) in test_cgfreezer_stopped()
734 pid = cg_run_nowait(cgroup, child_fn, NULL); in test_cgfreezer_stopped()
736 if (cg_wait_for_proc_count(cgroup, 1)) in test_cgfreezer_stopped()
742 if (cg_check_frozen(cgroup, false)) in test_cgfreezer_stopped()
745 if (cg_freeze_wait(cgroup, true)) in test_cgfreezer_stopped()
748 if (cg_freeze_wait(cgroup, false)) in test_cgfreezer_stopped()
757 if (cgroup) in test_cgfreezer_stopped()
758 cg_destroy(cgroup); in test_cgfreezer_stopped()
759 free(cgroup); in test_cgfreezer_stopped()
769 char *cgroup = NULL; in test_cgfreezer_ptraced() local
772 cgroup = cg_name(root, "cg_test_ptraced"); in test_cgfreezer_ptraced()
773 if (!cgroup) in test_cgfreezer_ptraced()
776 if (cg_create(cgroup)) in test_cgfreezer_ptraced()
779 pid = cg_run_nowait(cgroup, child_fn, NULL); in test_cgfreezer_ptraced()
781 if (cg_wait_for_proc_count(cgroup, 1)) in test_cgfreezer_ptraced()
792 if (cg_check_frozen(cgroup, false)) in test_cgfreezer_ptraced()
795 if (cg_freeze_wait(cgroup, true)) in test_cgfreezer_ptraced()
802 if (cg_freeze_wait(cgroup, false)) in test_cgfreezer_ptraced()
814 if (cgroup) in test_cgfreezer_ptraced()
815 cg_destroy(cgroup); in test_cgfreezer_ptraced()
816 free(cgroup); in test_cgfreezer_ptraced()
820 static int vfork_fn(const char *cgroup, void *arg) in vfork_fn() argument
838 char *cgroup = NULL; in test_cgfreezer_vfork() local
840 cgroup = cg_name(root, "cg_test_vfork"); in test_cgfreezer_vfork()
841 if (!cgroup) in test_cgfreezer_vfork()
844 if (cg_create(cgroup)) in test_cgfreezer_vfork()
847 cg_run_nowait(cgroup, vfork_fn, NULL); in test_cgfreezer_vfork()
849 if (cg_wait_for_proc_count(cgroup, 2)) in test_cgfreezer_vfork()
852 if (cg_freeze_wait(cgroup, true)) in test_cgfreezer_vfork()
858 if (cgroup) in test_cgfreezer_vfork()
859 cg_destroy(cgroup); in test_cgfreezer_vfork()
860 free(cgroup); in test_cgfreezer_vfork()