All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] credit2: Fix erronous ASSERT
@ 2013-03-08 14:14 George Dunlap
  2013-03-08 14:14 ` [PATCH 2/2] credit2: Reset until the front of the runqueue is positive George Dunlap
  2013-03-08 14:28 ` [PATCH 1/2] credit2: Fix erronous ASSERT Jan Beulich
  0 siblings, 2 replies; 6+ messages in thread
From: George Dunlap @ 2013-03-08 14:14 UTC (permalink / raw)
  To: xen-devel; +Cc: George Dunlap, Keir Fraser, Jan Beulich

In order to avoid high-frequency cpu migration, vcpus may in fact be
scheduled slightly out-of-order.  Account for this situation properly.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
---
 xen/common/sched_credit2.c |   40 ++++++++++++++++------------------------
 1 file changed, 16 insertions(+), 24 deletions(-)

diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c
index a7bd2ee..5bf5ebc 100644
--- a/xen/common/sched_credit2.c
+++ b/xen/common/sched_credit2.c
@@ -1544,31 +1544,23 @@ csched_runtime(const struct scheduler *ops, int cpu, struct csched_vcpu *snext)
         }
     }
 
-    /*
-     * snext is about to be scheduled; so:
-     *
-     * 1. if snext->credit were less than 0 when it was taken off the
-     * runqueue, then csched_schedule() should have called
-     * reset_credit().  So at this point snext->credit must be greater
-     * than 0.
-     *
-     * 2. snext's credit must be greater than or equal to anyone else
-     * in the queue, so snext->credit - swait->credit must be greater
-     * than or equal to 0.
-     */
-    ASSERT(rt_credit >= 0);
-
-    /* FIXME: See if we can eliminate this conversion if we know time
-     * will be outside (MIN,MAX).  Probably requires pre-calculating
-     * credit values of MIN,MAX per vcpu, since each vcpu burns credit
-     * at a different rate. */
-    time = c2t(rqd, rt_credit, snext);
-
-    /* Check limits */
-    if ( time < CSCHED_MIN_TIMER )
+    /* The next guy may actually have a higher credit, if we've */
+    if ( rt_credit < 0 )
         time = CSCHED_MIN_TIMER;
-    else if ( time > CSCHED_MAX_TIMER )
-        time = CSCHED_MAX_TIMER;
+    else
+    {
+        /* FIXME: See if we can eliminate this conversion if we know time
+         * will be outside (MIN,MAX).  Probably requires pre-calculating
+         * credit values of MIN,MAX per vcpu, since each vcpu burns credit
+         * at a different rate. */
+        time = c2t(rqd, rt_credit, snext);
+
+        /* Check limits */
+        if ( time < CSCHED_MIN_TIMER )
+            time = CSCHED_MIN_TIMER;
+        else if ( time > CSCHED_MAX_TIMER )
+            time = CSCHED_MAX_TIMER;
+    }
 
     return time;
 }
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-08 15:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-08 14:14 [PATCH 1/2] credit2: Fix erronous ASSERT George Dunlap
2013-03-08 14:14 ` [PATCH 2/2] credit2: Reset until the front of the runqueue is positive George Dunlap
2013-03-08 14:35   ` Jan Beulich
2013-03-08 15:04     ` George Dunlap
2013-03-08 15:13       ` Jan Beulich
2013-03-08 14:28 ` [PATCH 1/2] credit2: Fix erronous ASSERT Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.