When a vcpu which is exclusively pinned to a pcpu wakes up, we only have
one option: tickling that exact pcpu.

If sched_smt_cosched is enabled, however, it only makes sense to do that
if pcpu is in a core where vcpus of the domain are running already.

Signed-off-by: Dario Faggioli <dfaggi...@suse.com>
---
Cc: George Dunlap <george.dun...@eu.citrix.com>
---
 xen/common/sched_credit.c |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index e6f55cafc2..9d6071e229 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -372,6 +372,7 @@ static inline void __runq_tickle(struct csched_vcpu *new)
     unsigned int cpu = new->vcpu->processor;
     struct csched_vcpu * const cur = CSCHED_VCPU(curr_on_cpu(cpu));
     struct csched_private *prv = CSCHED_PRIV(per_cpu(scheduler, cpu));
+    struct csched_pcpu *spc = CSCHED_PCPU(cpu);
     cpumask_t mask, idle_mask, *online;
     int balance_step, idlers_empty;
 
@@ -396,9 +397,21 @@ static inline void __runq_tickle(struct csched_vcpu *new)
                   cpumask_test_cpu(cpu, &idle_mask)) )
     {
         ASSERT(cpumask_cycle(cpu, new->vcpu->cpu_hard_affinity) == cpu);
-        SCHED_STAT_CRANK(tickled_idle_cpu_excl);
-        __cpumask_set_cpu(cpu, &mask);
-        goto tickle;
+        spin_lock(&spc->core->lock);
+        /*
+         * If SMT co-scheduling of domains is enabled, we can only tickle
+         * either fully idle cores, or cores where new's domain is running
+         * already in (some of) the other thread(s).
+         */
+        if ( !sched_smt_cosched ||
+             spc->core->sdom == NULL || new->sdom == spc->core->sdom )
+        {
+            spin_unlock(&spc->core->lock);
+            SCHED_STAT_CRANK(tickled_idle_cpu_excl);
+            __cpumask_set_cpu(cpu, &mask);
+            goto tickle;
+        }
+        spin_lock(&spc->core->lock);
     }
 
     /*


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to