diff options
| author | Tejun Heo <tj@kernel.org> | 2026-03-24 10:21:47 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-03-24 10:21:57 -1000 |
| commit | 6680c162b4850976ee52b57372eddc4450c1d074 (patch) | |
| tree | d9a6fdca456b4da79302cf4d9cde271861f73228 /kernel/cgroup/cpuset.c | |
| parent | 1b164b876c36c3eb5561dd9b37702b04401b0166 (diff) | |
selftests/cgroup: Don't require synchronous populated update on task exit
test_cgcore_populated (test_core) and test_cgkill_{simple,tree,forkbomb}
(test_kill) check cgroup.events "populated 0" immediately after reaping
child tasks with waitpid(). This used to work because cgroup_task_exit() in
do_exit() unlinked tasks from css_sets before exit_notify() woke up
waitpid().
d245698d727a ("cgroup: Defer task cgroup unlink until after the task is done
switching out") moved the unlink to cgroup_task_dead() in
finish_task_switch(), which runs after exit_notify(). The populated counter
is now decremented after the parent's waitpid() can return, so there is no
longer a synchronous ordering guarantee. On PREEMPT_RT, where
cgroup_task_dead() is further deferred through lazy irq_work, the race
window is even larger.
The synchronous populated transition was never part of the cgroup interface
contract - it was an implementation artifact. Use cg_read_strcmp_wait() which
retries for up to 1 second, matching what these tests actually need to
verify: that the cgroup eventually becomes unpopulated after all tasks exit.
Fixes: d245698d727a ("cgroup: Defer task cgroup unlink until after the task is done switching out")
Reported-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
Tested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Christian Brauner <brauner@kernel.org>
Cc: cgroups@vger.kernel.org
Diffstat (limited to 'kernel/cgroup/cpuset.c')
0 files changed, 0 insertions, 0 deletions
