]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
sched_ext: Sync error_irq_work before freeing scx_sched
authorTejun Heo <tj@kernel.org>
Thu, 9 Oct 2025 23:56:23 +0000 (13:56 -1000)
committerTejun Heo <tj@kernel.org>
Mon, 13 Oct 2025 18:25:55 +0000 (08:25 -1000)
By the time scx_sched_free_rcu_work() runs, the scx_sched is no longer
reachable. However, a previously queued error_irq_work may still be pending or
running. Ensure it completes before proceeding with teardown.

Fixes: bff3b5aec1b7 ("sched_ext: Move disable machinery into scx_sched")
Acked-by: Andrea Righi <arighi@nvidia.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/sched/ext.c

index fc353b8d69f7d736d3081202d7e54166373c1be5..a79dfd0f743a3a9ca6a96c6faa1f4fe0658e8a39 100644 (file)
@@ -3471,7 +3471,9 @@ static void scx_sched_free_rcu_work(struct work_struct *work)
        struct scx_dispatch_q *dsq;
        int node;
 
+       irq_work_sync(&sch->error_irq_work);
        kthread_stop(sch->helper->task);
+
        free_percpu(sch->pcpu);
 
        for_each_node_state(node, N_POSSIBLE)