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

[Xen-changelog] [xen master] xen: credit2: do not warn if calling burn_credits more than once



commit 699afce62e772e6bdf1e1565761cf6955bfa1cce
Author:     Dario Faggioli <dario.faggioli@xxxxxxxxxx>
AuthorDate: Wed Jul 6 17:02:58 2016 +0100
Commit:     George Dunlap <george.dunlap@xxxxxxxxxx>
CommitDate: Fri Jul 8 11:04:48 2016 +0100

    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>
    Reviewed-by: George Dunlap <george.dunlap@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 d07806f..3ad6dc4 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);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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