]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
sched_ext: Dispatch from all scx_sched instances
authorTejun Heo <tj@kernel.org>
Fri, 6 Mar 2026 17:58:04 +0000 (07:58 -1000)
committerTejun Heo <tj@kernel.org>
Fri, 6 Mar 2026 17:58:04 +0000 (07:58 -1000)
The cgroup sub-sched support involves invasive changes to many areas of
sched_ext. The overall scaffolding is now in place and the next step is
implementing sub-sched enable/disable.

To enable partial testing and verification, update balance_one() to
dispatch from all scx_sched instances until it finds a task to run. This
should keep scheduling working when sub-scheds are enabled with tasks on
them. This will be replaced by BPF-driven hierarchical operation.

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

index 2430505ca06686d255137727976fd35d0cd0869c..bf23e092032b346c775eccb305afb9fdfc307237 100644 (file)
@@ -2526,7 +2526,7 @@ static bool scx_dispatch_sched(struct scx_sched *sch, struct rq *rq,
 
 static int balance_one(struct rq *rq, struct task_struct *prev)
 {
-       struct scx_sched *sch = scx_root;
+       struct scx_sched *sch = scx_root, *pos;
        s32 cpu = cpu_of(rq);
 
        lockdep_assert_rq_held(rq);
@@ -2570,9 +2570,13 @@ static int balance_one(struct rq *rq, struct task_struct *prev)
        if (rq->scx.local_dsq.nr)
                goto has_tasks;
 
-       /* dispatch @sch */
-       if (scx_dispatch_sched(sch, rq, prev))
-               goto has_tasks;
+       /*
+        * TEMPORARY - Dispatch all scheds. This will be replaced by BPF-driven
+        * hierarchical operation.
+        */
+       list_for_each_entry_rcu(pos, &scx_sched_all, all)
+               if (scx_dispatch_sched(pos, rq, prev))
+                       goto has_tasks;
 
        /*
         * Didn't find another task to run. Keep running @prev unless