On Mon, Mar 23, 2026 at 10:28:29AM -1000, Tejun Heo wrote:
> 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 <[email protected]>
> Signed-off-by: Tejun Heo <[email protected]>
> Cc: Christian Brauner <[email protected]>
> Cc: [email protected]
> ---

Seems fine to me.

Reply via email to