[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 05/19] xen: credit2: do not warn if calling burn_credits more than once
on the same vcpu, without NOW() having changed. This is, in fact, a legitimate use case. If it happens, we should just do nothing, without producing any warning or debug message. While there, fix style and add a couple of branching hints. Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx> --- Cc: George Dunlap <george.dunlap@xxxxxxxxxx> Cc: Anshul Makkar <anshul.makkar@xxxxxxxxxx> Cc: David Vrabel <david.vrabel@xxxxxxxxxx> --- xen/common/sched_credit2.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xen/common/sched_credit2.c b/xen/common/sched_credit2.c index ef199e3..9e8e561 100644 --- a/xen/common/sched_credit2.c +++ b/xen/common/sched_credit2.c @@ -738,14 +738,15 @@ static void reset_credit(const struct scheduler *ops, int cpu, s_time_t now, /* No need to resort runqueue, as everyone's order should be the same. */ } -void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_vcpu *svc, s_time_t now) +void burn_credits(struct csched2_runqueue_data *rqd, + struct csched2_vcpu *svc, s_time_t now) { s_time_t delta; /* Assert svc is current */ ASSERT(svc==CSCHED2_VCPU(curr_on_cpu(svc->vcpu->processor))); - if ( is_idle_vcpu(svc->vcpu) ) + if ( unlikely(is_idle_vcpu(svc->vcpu)) ) { BUG_ON(svc->credit != CSCHED2_IDLE_CREDIT); return; @@ -753,13 +754,16 @@ void burn_credits(struct csched2_runqueue_data *rqd, struct csched2_vcpu *svc, s delta = now - svc->start_time; - if ( delta > 0 ) { + if ( likely(delta > 0) ) + { SCHED_STAT_CRANK(burn_credits_t2c); t2c_update(rqd, delta, svc); svc->start_time = now; d2printk("b %pv c%d\n", svc->vcpu, svc->credit); - } else { + } + else if ( delta < 0 ) + { d2printk("%s: Time went backwards? now %"PRI_stime" start %"PRI_stime"\n", __func__, now, svc->start_time); } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |