]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
cgroup, sched_ext: Include exiting tasks in cgroup iter
authorTejun Heo <tj@kernel.org>
Tue, 28 Apr 2026 00:16:34 +0000 (14:16 -1000)
committerTejun Heo <tj@kernel.org>
Mon, 4 May 2026 19:06:03 +0000 (09:06 -1000)
commit60f21a2649308bbd84919ba6656d5ccd660953cf
treedfd1d5e35139b965ab95348d16ddf1b71b681fb5
parentd99f7a32f09dccbe396187370ec1a74a31b73d7e
cgroup, sched_ext: Include exiting tasks in cgroup iter

a72f73c4dd9b ("cgroup: Don't expose dead tasks in cgroup") made
css_task_iter_advance() skip exiting tasks so cgroup.procs stays consistent
with waitpid() visibility. Unfortunately, this broke scx_task_iter.

scx_task_iter walks either scx_tasks (global) or a cgroup subtree via
css_task_iter() and the two modes are expected to cover the same set of
tasks. After the above change the cgroup-scoped mode silently skips tasks
past exit_signals() that are still on scx_tasks.

scx_sub_enable_workfn()'s abort path is one of the symptoms: an exiting
SCX_TASK_SUB_INIT task can race past the cgroup iter leaking
__scx_init_task() state. Other iterations share the same gap.

Add CSS_TASK_ITER_WITH_DEAD to opt out of the skip and use it from
scx_task_iter().

Fixes: b0e4c2f8a0f0 ("sched_ext: Implement cgroup subtree iteration for scx_task_iter")
Reported-by: Cheng-Yang Chou <yphbchou0911@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
include/linux/cgroup.h
kernel/cgroup/cgroup.c
kernel/sched/ext.c