Skip to contentSkip to conversation

sched/null: skip vCPUs on the waitqueue that are blocked

PATCH Superseded Roger Pau Monne 2 participants 3 messages Dec 19, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/null: skip vCPUs on the waitqueue that are blocked

Avoid scheduling vCPUs that are blocked, there's no point in assigning them to a pCPU because they are not going to run anyway and might prevent a non-blocked vCPU from actually running.

---
Cc: George Dunlap <[email protected]>
Cc: Dario Faggioli <[email protected]>

---
 xen/common/sched_null.c | 4 ++++
 1 file changed, 4 insertions(+)
xen/common/sched_null.c +4 -0
index b4a24baf8e..78a3b12845 100644
@@ -781,6 +781,10 @@ static struct task_slice null_schedule(const struct scheduler *ops,
         {
             list_for_each_entry( wvc, &prv->waitq, waitq_elem )
             {
+                if ( test_bit(_VPF_down, &wvc->vcpu->pause_flags) )
+                    /* Skip vCPUs that are down. */
+                    continue;
+
                 if ( bs == BALANCE_SOFT_AFFINITY &&
                      !has_soft_affinity(wvc->vcpu, wvc->vcpu->cpu_hard_affinity) )
                     continue;
Signature · 7 lines
2.14.3 (Apple Git-98)


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

xen/common/sched_null.c static struct task_slice null_schedule(const struct scheduler *ops, · line 786

Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 19.12.17 at 15:16, <[email protected]> wrote:
xen/common/sched_null.c +3 -0
@@ -781,6 +781,10 @@ static struct task_slice null_schedule(const struct scheduler *ops,
         {
             list_for_each_entry( wvc, &prv->waitq, waitq_elem )
             {
+                if ( test_bit(_VPF_down, &wvc->vcpu->pause_flags) )
+                    /* Skip vCPUs that are down. */
+                    continue;

If such a custom check is indeed necessary here (looks to rather be something generic scheduling code should be dealing with), why would you take into consideration only this one VPF bit?

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 14 lines · Jan Beulich

xen/common/sched_null.c static struct task_slice null_schedule(const struct scheduler *ops, · line 786

Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 19.12.17 at 15:16, <[email protected]> wrote:
xen/common/sched_null.c +3 -0
@@ -781,6 +781,10 @@ static struct task_slice null_schedule(const struct scheduler *ops,
         {
             list_for_each_entry( wvc, &prv->waitq, waitq_elem )
             {
+                if ( test_bit(_VPF_down, &wvc->vcpu->pause_flags) )
+                    /* Skip vCPUs that are down. */
+                    continue;

If such a custom check is indeed necessary here (looks to rather be something generic scheduling code should be dealing with), why would you take into consideration only this one VPF bit?

I know that at least when a vCPU is brought up a call to vcpu_wake happens and the vCPU is scheduled. The same happens for unpause and some of the other events, but I'm not sure whether it applies to all of them.

IMHO 'down' was the clearer one since there's no chance the vCPU is going to run in the near future if it's not brought up. Other pause_flags like 'blocked_in_xen' or 'migrating' seem more temporary.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel