diff options
author | George Dunlap <george.dunlap@eu.citrix.com> | 2013-03-11 09:56:02 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2013-03-11 09:56:02 +0100 |
commit | 582ea94410cb266bbf3cd308046f5ea8ae25055f (patch) | |
tree | 8fbced064243b824ae22c40e5f8ac25e9e4445ae /xen/common/sched_credit2.c | |
parent | 6d112f2b50ba9cf6ecf0b35eea691345cc0196d7 (diff) | |
download | xen-582ea94410cb266bbf3cd308046f5ea8ae25055f.tar.gz xen-582ea94410cb266bbf3cd308046f5ea8ae25055f.tar.bz2 xen-582ea94410cb266bbf3cd308046f5ea8ae25055f.zip |
credit2: Fix erronous ASSERT
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>
Diffstat (limited to 'xen/common/sched_credit2.c')
-rw-r--r-- | xen/common/sched_credit2.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index a7bd2ee6c0..03814b7468 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -1544,31 +1544,24 @@ 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 tried to + * avoid migrating him from a different cpu. DTRT. */ + 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; } |