[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [RFC PATCH v1 03/16] xen: Credit1: do not always tickle an idle pcpu



If a vcpu wakes up on an idle pcpu, we always (try to) run it there.
This may seem ok but it may actually be not, in case there is another
(also idle) pcpu which would be better suited (for load balancing and/or
affinity reasons, for instance) to run it.

So, instead than blindly tickle the pcpu where the vcpu wakes up, let's
go through the tickling, even if it was idle. If there is no 'better'
pcpu where to run it, we still prefer the one where it woke up, among
others with similar characteristics.

Signed-off-by: Dario Faggioli <dfaggioli@xxxxxxxx>
---
Cc: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
---
 xen/common/sched_credit.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index 48d80993b1..d0eeb5a335 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -373,21 +373,18 @@ static inline void __runq_tickle(struct csched_vcpu *new)
     }
 
     /*
-     * If the pcpu is idle, or there are no idlers and the new
-     * vcpu is a higher priority than the old vcpu, run it here.
-     *
+     * If there are no idlers, and the new vcpu is a higher priority than
+     * the old vcpu, run it here.
+    *
      * If there are idle cpus, first try to find one suitable to run
      * new, so we can avoid preempting cur.  If we cannot find a
      * suitable idler on which to run new, run it here, but try to
      * find a suitable idler on which to run cur instead.
      */
-    if ( cur->pri == CSCHED_PRI_IDLE
-         || (idlers_empty && new->pri > cur->pri) )
+    if ( idlers_empty && new->pri > cur->pri )
     {
-        if ( cur->pri != CSCHED_PRI_IDLE )
-            SCHED_STAT_CRANK(tickled_busy_cpu);
-        else
-            SCHED_STAT_CRANK(tickled_idle_cpu);
+        ASSERT(cpumask_test_cpu(cpu, new->vcpu->cpu_hard_affinity));
+        SCHED_STAT_CRANK(tickled_busy_cpu);
         __cpumask_set_cpu(cpu, &mask);
     }
     else if ( !idlers_empty )
@@ -452,9 +449,12 @@ static inline void __runq_tickle(struct csched_vcpu *new)
                 SCHED_STAT_CRANK(tickled_idle_cpu);
                 if ( opt_tickle_one_idle )
                 {
-                    this_cpu(last_tickle_cpu) =
-                        cpumask_cycle(this_cpu(last_tickle_cpu),
-                                      cpumask_scratch_cpu(cpu));
+                    if ( cpumask_test_cpu(cpu, cpumask_scratch_cpu(cpu)) )
+                        this_cpu(last_tickle_cpu) = cpu;
+                    else
+                        this_cpu(last_tickle_cpu) =
+                            cpumask_cycle(this_cpu(last_tickle_cpu),
+                                          cpumask_scratch_cpu(cpu));
                     __cpumask_set_cpu(this_cpu(last_tickle_cpu), &mask);
                 }
                 else


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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.