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

[Xen-devel] [RFC PATCH v1 07/16] xen: Credit1: reorg __runq_tickle() code a bit.



Basically, for dealing earlier with the case when there are some idle
pcpus that are suitable for running the newly waking vcpu (and bailing
out if not).

This is pure code refactoring, with the purpose of separating code
movement and functional changes (coming in follow-up commits).

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

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index af3b81d377..e218eb6986 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -413,7 +413,7 @@ static inline void __runq_tickle(struct csched_vcpu *new)
          */
         for_each_affinity_balance_step( balance_step )
         {
-            int new_idlers_empty;
+            bool new_idlers_empty;
 
             if ( balance_step == BALANCE_SOFT_AFFINITY
                  && !has_soft_affinity(new->vcpu) )
@@ -444,6 +444,19 @@ static inline void __runq_tickle(struct csched_vcpu *new)
                  && balance_step == BALANCE_SOFT_AFFINITY )
                 continue;
 
+            /*
+             * If there are suitable idlers for new, no matter priorities,
+             * leave cur alone (as it is running and is, likely, cache-hot)
+             * and wake some of them (which is waking up and so is, likely,
+             * cache cold anyway), and go for one of them.
+             */
+            if ( !new_idlers_empty )
+            {
+                SCHED_STAT_CRANK(tickled_idle_cpu);
+                cpumask_or(&mask, &mask, cpumask_scratch_cpu(cpu));
+                break;
+            }
+
             /*
              * If there are no suitable idlers for new, and it's higher
              * priority than cur, check whether we can migrate cur away.
@@ -451,7 +464,7 @@ static inline void __runq_tickle(struct csched_vcpu *new)
              * of just tickling any idler suitable for cur) because cur
              * is running.
              */
-            if ( new_idlers_empty && new->pri > cur->pri )
+            if ( new->pri > cur->pri )
             {
                 if ( cpumask_intersects(cur->vcpu->cpu_hard_affinity,
                                         &idle_mask) )
@@ -467,21 +480,8 @@ static inline void __runq_tickle(struct csched_vcpu *new)
                 goto tickle;
             }
 
-            /*
-             * If there are suitable idlers for new, no matter priorities,
-             * leave cur alone (as it is running and is, likely, cache-hot)
-             * and wake some of them (which is waking up and so is, likely,
-             * cache cold anyway).
-             */
-            if ( !new_idlers_empty )
-            {
-                SCHED_STAT_CRANK(tickled_idle_cpu);
-                cpumask_or(&mask, &mask, cpumask_scratch_cpu(cpu));
-            }
-
-            /* Did we find anyone? */
-            if ( !cpumask_empty(&mask) )
-                break;
+            /* We get here only if we didn't find anyone. */
+            ASSERT(cpumask_empty(&mask));
         }
     }
 


_______________________________________________
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®.