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

[Xen-devel] [RFC PATCH v1 12/16] xen: Credit1: support sched_smt_cosched in csched_runq_steal().



If sched_smt_cosched is enabled, when poking at other pcpus' runqueues
(for doing load balancing), we only consider the vcpus of the domain
that is running on the core already. Unless the core is fully idle, in
which case, we can pick up any vcpu.

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

diff --git a/xen/common/sched_credit.c b/xen/common/sched_credit.c
index 81a2c8b384..18167ee399 100644
--- a/xen/common/sched_credit.c
+++ b/xen/common/sched_credit.c
@@ -1705,6 +1705,7 @@ csched_runq_steal(int peer_cpu, int cpu, int pri, int 
balance_step)
 {
     const struct csched_private * const prv = CSCHED_PRIV(per_cpu(scheduler, 
cpu));
     const struct csched_pcpu * const peer_pcpu = CSCHED_PCPU(peer_cpu);
+    const struct csched_pcpu * const spc = CSCHED_PCPU(cpu);
     struct csched_vcpu *speer;
     struct list_head *iter;
     struct vcpu *vc;
@@ -1722,9 +1723,26 @@ csched_runq_steal(int peer_cpu, int cpu, int pri, int 
balance_step)
         /*
          * If next available VCPU here is not of strictly higher
          * priority than ours, this PCPU is useless to us.
+         *
+         * On the other hand, with sched_smt_cosched enabled, we are ok with
+         * vcpus that have the same prio as our candidate, as far as they come
+         * from the same domain which is already running on this core.
          */
-        if ( speer->pri <= pri )
-            break;
+        if ( !sched_smt_cosched )
+        {
+            if ( speer->pri <= pri )
+                break;
+        }
+        else
+        {
+            /* XXX: This should be more 'compact' */
+            if ( is_idle_vcpu(speer->vcpu) )
+                break;
+            if ( speer->pri < pri )
+                break;
+            if ( speer->pri == pri && spc->core->sdom == NULL )
+                break;
+        }
 
         /* Is this VCPU runnable on our PCPU? */
         vc = speer->vcpu;


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