mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-23 19:14:30 +08:00
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>
This commit is contained in:
parent
340272b040
commit
0de3103fa2
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user