]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
sched_ext: Drop NONE early return in scx_disable_and_exit_task()
authorTejun Heo <tj@kernel.org>
Tue, 12 May 2026 20:30:00 +0000 (10:30 -1000)
committerTejun Heo <tj@kernel.org>
Tue, 12 May 2026 21:13:58 +0000 (11:13 -1000)
commit39e25a2100604320e8d9df54c6c31258f7a3df29
treea409add59e45d775ae32e631319048ee2cc32f87
parent9a415cc53711f2238e0f0ca8a6bcc796c003b127
sched_ext: Drop NONE early return in scx_disable_and_exit_task()

d3e73a0808dd ("sched_ext: Handle SCX_TASK_NONE in disable/switched_from
paths") skipped the trailing scx_set_task_sched(p, NULL) on NONE tasks.
After scx_fail_parent() parks a task at NONE/sched=parent and the parent
is later freed via queue_rcu_work() during root_disable, the preserved
p->scx.sched dangles - print_scx_info() from sched_show_task() reads
sch->ops.name from freed memory.

Drop the early return. __scx_disable_and_exit_task() already short-
circuits on NONE and the SUB_INIT block was cleared by
scx_fail_parent()'s earlier call, so clearing p->scx.sched is the only
work left - and the one thing the path actually needs.

v2: Extend the SUB_INIT block comment to note that the flag is only
    set on the sub-enable path, so it's always clear on the NONE
    re-entry (Andrea).

Fixes: d3e73a0808dd ("sched_ext: Handle SCX_TASK_NONE in disable/switched_from paths")
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
kernel/sched/ext.c