cgroup: Include dying leaders with live threads in PROCS iterations
authorTejun Heo <tj@kernel.org>
Fri, 31 May 2019 17:38:58 +0000 (10:38 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Aug 2019 15:52:34 +0000 (17:52 +0200)
commit4340d175b89896d069c1e875f5b98c80a408f680
tree6bf38ad823b9b8218a9605cd6df220b97d387ae4
parent370b9e6399da09fe10005fe455878b356de7b85f
cgroup: Include dying leaders with live threads in PROCS iterations

commit c03cd7738a83b13739f00546166969342c8ff014 upstream.

CSS_TASK_ITER_PROCS currently iterates live group leaders; however,
this means that a process with dying leader and live threads will be
skipped.  IOW, cgroup.procs might be empty while cgroup.threads isn't,
which is confusing to say the least.

Fix it by making cset track dying tasks and include dying leaders with
live threads in PROCS iteration.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-and-tested-by: Topi Miettinen <toiwoton@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/cgroup-defs.h
include/linux/cgroup.h
kernel/cgroup/cgroup.c