Skip to contentSkip to conversation

xen/sched: try harder to find a runnable unit in rt_schedule()

PATCH In review Juergen Gross 2 participants 2 messages Oct 21, 2022 – Nov 4, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/sched: try harder to find a runnable unit in rt_schedule()

Instead of directly falling back to the idle unit in case the top unit from the run queue happened to be not runnable, consult the run queue again.

---
 xen/common/sched/rt.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)
xen/common/sched/rt.c +11 -6
index 960a8033e2..1f8d074884 100644
@@ -1080,15 +1080,20 @@ rt_schedule(const struct scheduler *ops, struct sched_unit *currunit,
     }
     else
     {
-        snext = runq_pick(ops, cpumask_of(sched_cpu), cur_cpu);
-
-        if ( snext == NULL )
-            snext = rt_unit(sched_idle_unit(sched_cpu));
-        else if ( !unit_runnable_state(snext->unit) )
+        while ( true )
         {
+            snext = runq_pick(ops, cpumask_of(sched_cpu), cur_cpu);
+
+            if ( snext == NULL )
+            {
+                snext = rt_unit(sched_idle_unit(sched_cpu));
+                break;
+            }
+            if ( unit_runnable_state(snext->unit) )
+                break;
+
             q_remove(snext);
             replq_remove(ops, snext);
-            snext = rt_unit(sched_idle_unit(sched_cpu));
         }
 
         /* if scurr has higher priority and budget, still pick scurr */
Signature · 1 line
2.35.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Juergen Gross

Instead of directly falling back to the idle unit in case the top unit from the run queue happened to be not runnable, consult the run queue again.

And thanks for making the patch! :-)

Regards

Signature · 6 lines
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)