]> www.infradead.org Git - users/willy/xarray.git/commitdiff
sched_ext: Clean up SCX_EXIT_NONE handling in scx_disable_workfn()
authorTejun Heo <tj@kernel.org>
Tue, 29 Apr 2025 18:40:11 +0000 (08:40 -1000)
committerTejun Heo <tj@kernel.org>
Tue, 29 Apr 2025 18:40:11 +0000 (08:40 -1000)
With the global states and disable machinery moved into scx_sched,
scx_disable_workfn() can only be scheduled and run for the specific
scheduler instance. This makes it impossible for scx_disable_workfn() to see
SCX_EXIT_NONE. Turn that condition into WARN_ON_ONCE().

Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Andrea Righi <arighi@nvidia.com>
Acked-by: Changwoo Min <changwoo@igalia.com>
kernel/sched/ext.c

index a21390c9e9772b543f9ae7d7a2254084c154e7b8..66d21c7cdff7dff7e87d8c954b734c4b3d72c95d 100644 (file)
@@ -4752,13 +4752,9 @@ static void scx_disable_workfn(struct kthread_work *work)
 
        kind = atomic_read(&sch->exit_kind);
        while (true) {
-               /*
-                * NONE indicates that a new scx_ops has been registered since
-                * disable was scheduled - don't kill the new ops. DONE
-                * indicates that the ops has already been disabled.
-                */
-               if (kind == SCX_EXIT_NONE || kind == SCX_EXIT_DONE)
+               if (kind == SCX_EXIT_DONE)      /* already disabled? */
                        return;
+               WARN_ON_ONCE(kind == SCX_EXIT_NONE);
                if (atomic_try_cmpxchg(&sch->exit_kind, &kind, SCX_EXIT_DONE))
                        break;
        }