]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched_ext: Pin parent scx_sched across a child sub-scheduler's lifetime
authorTejun Heo <tj@kernel.org>
Thu, 25 Jun 2026 23:23:56 +0000 (13:23 -1000)
committerTejun Heo <tj@kernel.org>
Mon, 29 Jun 2026 20:10:29 +0000 (10:10 -1000)
commitcb36d81e751173c4b59b5e561c596c925144ea48
treee42cb255f5467c4de970493819757f3821cc00a8
parent115d1ce989747045bd7745c7ab020982660c7e42
sched_ext: Pin parent scx_sched across a child sub-scheduler's lifetime

A child sub-scheduler dereferences its parent scx_sched throughout its life,
e.g., in scx_sub_disable() which reparents the child's tasks and calls
parent->ops.sub_detach() after unlinking from the parent. However, the
parent is pinned only through parent->sub_kset, which is dropped during
disable. The parent scx_sched can be RCU-freed while a child is still
disabling.

Take a direct reference on the parent in scx_alloc_and_add_sched(), dropped
in scx_sched_free_rcu_work(), so a parent always outlives its descendants.

Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext/ext.c