summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/cgroup/cgroup_util.c
diff options
context:
space:
mode:
authorChristian Brauner <christian.brauner@ubuntu.com>2021-05-08 14:15:40 +0200
committerTejun Heo <tj@kernel.org>2021-05-10 16:41:10 +0200
commit0de3103fa2cf9ed07cfde3e4fd578ead5de52047 (patch)
tree64fee5c87944904ab92c7f1a771d235f9685b226 /tools/testing/selftests/cgroup/cgroup_util.c
parentdocs/cgroup: add entry for cgroup.kill (diff)
downloadlinux-0de3103fa2cf9ed07cfde3e4fd578ead5de52047.tar.xz
linux-0de3103fa2cf9ed07cfde3e4fd578ead5de52047.zip
tests/cgroup: use cgroup.kill in cg_killall()
If cgroup.kill file is supported make use of it. Link: https://lore.kernel.org/r/20210503143922.3093755-3-brauner@kernel.org Cc: Tejun Heo <tj@kernel.org> Cc: cgroups@vger.kernel.org Reviewed-by: Shakeel Butt <shakeelb@google.com> Acked-by: Roman Gushchin <guro@fb.com> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to '')
-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;