diff options
| author | Tejun Heo <tj@kernel.org> | 2026-03-25 07:23:48 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-03-25 14:08:04 -1000 |
| commit | 4c56a8ac6869855866de0bb368a4189739e1d24f (patch) | |
| tree | 671cfe0c2a9456f1a55dbdc6d4eb2131fa525d0d /kernel/cgroup/cpuset.c | |
| parent | 6680c162b4850976ee52b57372eddc4450c1d074 (diff) | |
cgroup: Fix cgroup_drain_dying() testing the wrong condition
cgroup_drain_dying() was using cgroup_is_populated() to test whether there are
dying tasks to wait for. cgroup_is_populated() tests nr_populated_csets,
nr_populated_domain_children and nr_populated_threaded_children, but
cgroup_drain_dying() only needs to care about this cgroup's own tasks - whether
there are children is cgroup_destroy_locked()'s concern.
This caused hangs during shutdown. When systemd tried to rmdir a cgroup that had
no direct tasks but had a populated child, cgroup_drain_dying() would enter its
wait loop because cgroup_is_populated() was true from
nr_populated_domain_children. The task iterator found nothing to wait for, yet
the populated state never cleared because it was driven by live tasks in the
child cgroup.
Fix it by using cgroup_has_tasks() which only tests nr_populated_csets.
v3: Fix cgroup_is_populated() -> cgroup_has_tasks() (Sebastian).
v2: https://lore.kernel.org/r/20260323200205.1063629-1-tj@kernel.org
Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Fixes: 1b164b876c36 ("cgroup: Wait for dying tasks to leave on rmdir")
Signed-off-by: Tejun Heo <tj@kernel.org>
Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Diffstat (limited to 'kernel/cgroup/cpuset.c')
0 files changed, 0 insertions, 0 deletions
