diff options
| author | Tejun Heo <tj@kernel.org> | 2026-07-17 22:12:20 -1000 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2026-07-19 21:10:56 -1000 |
| commit | bf9dee58ab565a2b4bfd26cf6b235989d527f7a4 (patch) | |
| tree | fc5dae0dc3408de0d3428360aaf43076db4f12c8 /tools/perf/scripts/python/stackcollapse.py | |
| parent | 54880aeb872b870904454ae20d179d32622494dc (diff) | |
sched_ext: Re-home tasks on cgroup migration
A task's sched (p->scx.sched) must match its cgroup's owner
(cgrp->scx_sched). cgroup migration breaks the invariant:
scx_cgroup_move_task() only fires root's ops.cgroup_move() and never
re-homes the task, leading to wrong-sched scheduling and, once the stale
sched is freed, a use-after-free.
Hook into the new cgroup task migration events and re-home each task whose
destination cgroup is owned by a different sched. The events map naturally
to the transfer: MIGRATING runs the fallible init for the destination sched,
letting it reject the migration the same way ops.cgroup_prep_move() can,
MIGRATED does the re-home, which can't fail, and CANCELED undoes the init
when the migration falls through.
Pre-commit, the task's task_group still reflects the source, so
__scx_init_task() grows an explicit cgroup argument for the migration path
to hand ops.init_task() the destination cgroup.
Signed-off-by: Tejun Heo <tj@kernel.org>
Closes: https://lore.kernel.org/r/alnxrsexEe_nQwqL@gpd4
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions
