[Xen-devel] [PATCH] xen: schedule: initialize 'now' when really needed

Baodong Chen posted 1 patch 4 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/xen tags/patchew/1559284268-8280-1-git-send-email-chenbaodong@mxnavi.com
xen/common/schedule.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
[Xen-devel] [PATCH] xen: schedule: initialize 'now' when really needed
Posted by Baodong Chen 4 years, 10 months ago
when 'periodic_period' is zero, there is no need to initialize 'now'.

Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
---
 xen/common/schedule.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/schedule.c b/xen/common/schedule.c
index 66f1e26..86341bc 100644
--- a/xen/common/schedule.c
+++ b/xen/common/schedule.c
@@ -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 )
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [Xen-devel] [PATCH] xen: schedule: initialize 'now' when really needed
Posted by Dario Faggioli 4 years, 10 months ago
On Fri, 2019-05-31 at 14:31 +0800, Baodong Chen wrote:
> when 'periodic_period' is zero, there is no need to initialize 'now'.
> 
> Signed-off-by: Baodong Chen <chenbaodong@mxnavi.com>
> ---
>  xen/common/schedule.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
Acked-by: Dario Faggioli <dfaggioli@suse.com>

Regards
-- 
Dario Faggioli, Ph.D
http://about.me/dario.faggioli
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
-------------------------------------------------------------------
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel