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

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


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 15 Jun 2026 15:39:44 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=teoBfYHHS7C45KLJXxm9+ZQbI7VZO+28Yj4mxqqWvqk=; b=NQ8St5cDKZRfIql89yXB0M/xI6jZD4TbWEf7Fbrmmq4O7xKiTwLCk8GUf7ujn/g5Z/tUUPWfB5G23BOdVX17rCK11JwI94YnXHT0FPhX6bs7xmgJe8kUK1XdSQYoCQimOsS/HLJrOJbk+Dkr6sNCTNpmJlfQuGhoFD+kDs/324CJWamTUdQw/npAmNyTgCJx0WefgnLvaw0EOw2YZKL7S4DS3mGKRoNCe1fIUHITAZyRGGjp/SwEsZ1paDjeCvzMr7dwXPqnUsYS3S6ShbU4p8JbDQl1MebEIeZj8QdQpjYv3ab0BYFHYjCIh6iZ9v/h7C1SHZNifBrgJByqxADjeg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U+kUcirfx8I9hQY2Ruz7Pn1Pv7j+U8g+oNIR1aw0wC94zjy2O1DWHDIVa6gTmTlqOjab0FmiIYp+EzkFmI1fjzuHG4M0HErQB8yo6HSsfdG2YQfzpn3MsJBzm7KCOizAna2ekUDVKpaeC4Zkzf+fdhLgYVoZblalKw3LgkSaIeXeMF7pU4opbzqEma3FLrqJI6niy/cjMGlt5VoIKCkSLB7pDgcaMbl96slNiV+A8WThfHzZvy2n8cdXBi/h3/9Ub3DdGQ2cL6y2mbxMPItODXQBlvJnrxrE6GzlFY4+5Dlpy5z2AwWq6Y7YVtSIWWOtAYbjZheyaEaqpZvrizpaiA==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Mon, 15 Jun 2026 19:40:11 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
This is backported in stable trees and should be reverted there as well
(found in 4.20.3).

A Fixes seems superfluous and not normally used with a revert, but if
needed:
Fixes: a0ed5bcfbeee ("xen/cpufreq: fix usages of align_timer() in the on-demand 
governor")
---
 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..537695eaab 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));
     }
 }
-- 
2.54.0




 


Rackspace

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