]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
credit2: during scheduling, update the idle mask before using it
authorDario Faggioli <dfaggioli@suse.com>
Thu, 22 Nov 2018 11:54:56 +0000 (11:54 +0000)
committerGeorge Dunlap <george.dunlap@citrix.com>
Thu, 22 Nov 2018 11:54:56 +0000 (11:54 +0000)
Load balancing, when happening, at the end of a "scheduler epoch", can
trigger vcpu migration, which in its turn may call runq_tickle(). If the
cpu where this happens was idle, but we're now going to schedule a vcpu
on it, let's update the runq's idle cpus mask accordingly _before_ doing
load balancing.

Not doing that, in fact, may cause runq_tickle() to think that the cpu
is still idle, and tickle it to go pick up a vcpu from the runqueue,
which might be wrong/unideal.

Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
Reviewed-by: George Dunlap <george.dunlap@citrix.com>
xen/common/sched_credit2.c

index 49a99c0a73473ac9442ea116b1f33373b4dbc63c..623a325ceb9c256dd859bb8ed49d8a68274b7459 100644 (file)
@@ -3555,6 +3555,13 @@ csched2_schedule(
             __set_bit(__CSFLAG_scheduled, &snext->flags);
         }
 
+        /* Clear the idle mask if necessary */
+        if ( cpumask_test_cpu(cpu, &rqd->idle) )
+        {
+            __cpumask_clear_cpu(cpu, &rqd->idle);
+            smt_idle_mask_clear(cpu, &rqd->smt_idle);
+        }
+
         /*
          * The reset condition is "has a scheduler epoch come to an end?".
          * The way this is enforced is checking whether the vcpu at the top
@@ -3575,13 +3582,6 @@ csched2_schedule(
             balance_load(ops, cpu, now);
         }
 
-        /* Clear the idle mask if necessary */
-        if ( cpumask_test_cpu(cpu, &rqd->idle) )
-        {
-            __cpumask_clear_cpu(cpu, &rqd->idle);
-            smt_idle_mask_clear(cpu, &rqd->smt_idle);
-        }
-
         snext->start_time = now;
         snext->tickled_cpu = -1;