aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Brauner <[email protected]>2021-05-08 14:15:40 +0200
committerTejun Heo <[email protected]>2021-05-10 10:41:10 -0400
commit0de3103fa2cf9ed07cfde3e4fd578ead5de52047 (patch)
tree64fee5c87944904ab92c7f1a771d235f9685b226
parent340272b04036f2b833a7094eca5c15e5ed8e184c (diff)
tests/cgroup: use cgroup.kill in cg_killall()
If cgroup.kill file is supported make use of it. Link: https://lore.kernel.org/r/[email protected] Cc: Tejun Heo <[email protected]> Cc: [email protected] Reviewed-by: Shakeel Butt <[email protected]> Acked-by: Roman Gushchin <[email protected]> Signed-off-by: Christian Brauner <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
-rw-r--r--tools/testing/selftests/cgroup/cgroup_util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/cgroup/cgroup_util.c b/tools/testing/selftests/cgroup/cgroup_util.c
index 027014662fb2..f60f7d764690 100644
--- a/tools/testing/selftests/cgroup/cgroup_util.c
+++ b/tools/testing/selftests/cgroup/cgroup_util.c
@@ -252,6 +252,10 @@ int cg_killall(const char *cgroup)
char buf[PAGE_SIZE];
char *ptr = buf;
+ /* If cgroup.kill exists use it. */
+ if (!cg_write(cgroup, "cgroup.kill", "1"))
+ return 0;
+
if (cg_read(cgroup, "cgroup.procs", buf, sizeof(buf)))
return -1;