]> xenbits.xensource.com Git - xen.git/commitdiff
schedule: initialize 'now' when really needed
authorBaodong Chen <chenbaodong@mxnavi.com>
Mon, 3 Jun 2019 15:15:44 +0000 (17:15 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 3 Jun 2019 15:15:44 +0000 (17:15 +0200)
when 'periodic_period' is zero, there is no need to initialize 'now'.

Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
Acked-by: Dario Faggioli <dfaggioli@suse.com>
xen/common/schedule.c

index 66f1e2611b1d910c5bd9bdfea45aef0f46da6729..86341bc8fbb9359bcf43608fffb26553ca8ac0c7 100644 (file)
@@ -1385,12 +1385,13 @@ long sched_adjust_global(struct xen_sysctl_scheduler_op *op)
 
 static void vcpu_periodic_timer_work(struct vcpu *v)
 {
-    s_time_t now = NOW();
+    s_time_t now;
     s_time_t periodic_next_event;
 
     if ( v->periodic_period == 0 )
         return;
 
+    now = NOW();
     periodic_next_event = v->periodic_last_event + v->periodic_period;
 
     if ( now >= periodic_next_event )