S Shakeel Butt #
Message details and related content
On Mon, May 3, 2021 at 7:40 AM Christian Brauner [off-list ref] wrote:
[...]
quoted hunk
+ +static int test_cgkill_simple(const char *root) +{ + pid_t pids[100]; + int ret = KSFT_FAIL; + char *cgroup = NULL; + int i; + + cgroup = cg_name(root, "cg_test_simple"); + if (!cgroup) + goto cleanup; + + if (cg_create(cgroup)) + goto cleanup; + + for (i = 0; i < 100; i++) + pids[i] = cg_run_nowait(cgroup, child_fn, NULL); + + if (cg_wait_for_proc_count(cgroup, 100)) + goto cleanup; + + if (cg_write(cgroup, "cgroup.kill", "1")) + goto cleanup;
I don't think the above write to cgroup.kill is correct.
quoted hunk
+ + if (cg_read_strcmp(cgroup, "cgroup.events", "populated 1\n")) + goto cleanup; + + if (cg_kill_wait(cgroup)) + goto cleanup; + + if (cg_read_strcmp(cgroup, "cgroup.events", "populated 0\n")) + goto cleanup; + + ret = KSFT_PASS; + +cleanup: + for (i = 0; i < 100; i++) + wait_for_pid(pids[i]); + + if (cgroup) + cg_destroy(cgroup); + free(cgroup); + return ret; +}