tests/cgroup: use cgroup.kill in cg_killall()

Started by Christian Brauner on May 3, 2021

Subsystems (3)

Maintainers (6)

Show 2 more
DORMANTno replies LANDED · 1 review, 0 by maintainers

Status: Landed in mainline as 0de3103fa2cf on 2021-05-10.

1 review trailer.

open the first message on its own page

Message details and related content
From: Christian Brauner <redacted>

If cgroup.kill file is supported make use of it.

Cc: Tejun Heo <redacted>
Cc: <redacted>
Acked-by: Roman Gushchin <redacted>
Signed-off-by: Christian Brauner <redacted>
---
/* v2 */
- Roman Gushchin [off-list ref]:
  - Fix whitespace.
---
 tools/testing/selftests/cgroup/cgroup_util.c | 4 ++++
 1 file changed, 4 insertions(+)
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;
 
-- 
2.27.0
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help