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

[xen master] Revert "xen/cpufreq: fix usages of align_timer() in the on-demand governor"



commit e301cd36de9e81879b4cd70cd5272cc81392b7f9
Author:     Jason Andryuk <jason.andryuk@xxxxxxx>
AuthorDate: Tue Jun 16 14:17:58 2026 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Jun 16 14:17:58 2026 +0200

    Revert "xen/cpufreq: fix usages of align_timer() in the on-demand governor"
    
    The original commit showed a ~6% regression in a benchmark.  The call to
    align_timer(firsttick, period) rounds firsttick up to the next mutiple
    of the period, if firsttick % period != 0:
    
    align_timer(0, period)          -> 0
    align_timer(1, period)          -> period
    align_timer(period, period)     -> period
    align_timer(period + 1, period) -> 2 * period
    
    So adding the period (sampling_rate) before calling align_timer() will
    in most cases incease the expiration to 2 * period (sampling_rate) (the
    exception being firsttick % period == 0).  This longer timer slows the
    reaction time of the algorithm.
    
    This reverts commit a0ed5bcfbeee81c91c574ad484faa057054eaf09, just without
    re-introducing the style issues that were there.
    
    Fixes: a0ed5bcfbeee ("xen/cpufreq: fix usages of align_timer() in the 
on-demand governor")
    Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
    Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
---
 xen/drivers/cpufreq/cpufreq_ondemand.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c 
b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 0d94c0e464..0a5d609b02 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -185,8 +185,7 @@ static void cf_check do_dbs_timer(void *dbs)
     dbs_check_cpu(dbs_info);
 
     set_timer(&per_cpu(dbs_timer, dbs_info->cpu),
-              align_timer(NOW() + dbs_tuners_ins.sampling_rate,
-                          dbs_tuners_ins.sampling_rate));
+              align_timer(NOW(), dbs_tuners_ins.sampling_rate));
 }
 
 static void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
@@ -401,6 +400,6 @@ void cpufreq_dbs_timer_resume(void)
             (void)cmpxchg(stoppable, -1, 1);
         }
         else
-            set_timer(t, align_timer(t->expires, 
dbs_tuners_ins.sampling_rate));
+            set_timer(t, align_timer(now, dbs_tuners_ins.sampling_rate));
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master



 


Rackspace

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