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

[Xen-changelog] [xen-unstable] credit2: Don't migrate cpus unnecessarily



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1291978264 0
# Node ID 8da6c29efada3e01f3298efd2f33ddca14a7fc08
# Parent  bbd9eda7b550e47c4b9461ef45528bc9e3f00693
credit2: Don't migrate cpus unnecessarily

Modern processors have one or two L3's per socket, and generally only
one core per L2.  Credit2's design relies on having credit shared
across several.  So as a first step to sharing a queue across L3 while
avoiding excessive cross-L2 migration

Step one: If the vcpu's current cpu is acceptable, just run it there.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
---
 xen/common/sched_credit2.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

diff -r bbd9eda7b550 -r 8da6c29efada xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c        Fri Dec 10 10:50:16 2010 +0000
+++ b/xen/common/sched_credit2.c        Fri Dec 10 10:51:04 2010 +0000
@@ -334,6 +334,7 @@ runq_tickle(const struct scheduler *ops,
     s_time_t lowest=(1<<30);
     struct csched_runqueue_data *rqd = RQD(ops, cpu);
     cpumask_t *online, mask;
+    struct csched_vcpu * cur;
 
     d2printk("rqt d%dv%d cd%dv%d\n",
              new->vcpu->domain->domain_id,
@@ -341,8 +342,18 @@ runq_tickle(const struct scheduler *ops,
              current->domain->domain_id,
              current->vcpu_id);
 
-    online = CSCHED_CPUONLINE(per_cpu(cpupool, cpu));
-
+    BUG_ON(new->vcpu->processor != cpu);
+
+    /* Look at the cpu it's running on first */
+    cur = CSCHED_VCPU(per_cpu(schedule_data, cpu).curr);
+    burn_credits(rqd, cur, now);
+
+    if ( cur->credit < new->credit )
+    {
+        ipid = cpu;
+        goto tickle;
+    }
+    
     /* Get a mask of idle, but not tickled */
     cpus_andnot(mask, rqd->idle, rqd->tickled);
     
@@ -355,12 +366,18 @@ runq_tickle(const struct scheduler *ops,
 
     /* Otherwise, look for the non-idle cpu with the lowest credit,
      * skipping cpus which have been tickled but not scheduled yet */
+    online = CSCHED_CPUONLINE(per_cpu(cpupool, cpu));
+
     cpus_andnot(mask, *online, rqd->idle);
     cpus_andnot(mask, mask, rqd->tickled);
 
     for_each_cpu_mask(i, mask)
     {
         struct csched_vcpu * cur;
+
+        /* Already looked at this one above */
+        if ( i == cpu )
+            continue;
 
         cur = CSCHED_VCPU(per_cpu(schedule_data, i).curr);
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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