|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging-4.21] xen/cpufreq: fix adjusting of sampling window on early exit
commit ae0708e940ea56e7cc4369732310353c4d1790b0
Author: Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Wed Mar 4 14:50:04 2026 +0100
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Wed Mar 4 14:50:04 2026 +0100
xen/cpufreq: fix adjusting of sampling window on early exit
The logic in dbs_check_cpu() resets the sampling window even when the
sampling period is considered too small. This leads to further calls
finding an imbalance between the total window time and the idle time, as
the total window time is possibly shorter than the idle time.
Fix by resetting the sampling window start time in the same block where the
current idle time is stored. While there also prevent a duplicated call to
NOW() and instead re-use the previously fetched value.
Fixes: d6f001cb91ac ("x86: Implement cpufreq ondemand policy")
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
master commit: 74867aae25cb6356b8a7d1140c81666e2a23b818
master date: 2026-03-02 17:16:26 +0100
---
xen/drivers/cpufreq/cpufreq_ondemand.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/xen/drivers/cpufreq/cpufreq_ondemand.c
b/xen/drivers/cpufreq/cpufreq_ondemand.c
index 0126a3f5d9..537695eaab 100644
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c
@@ -117,11 +117,12 @@ static void dbs_check_cpu(struct cpu_dbs_info_s
*this_dbs_info)
cur_ns = NOW();
total_ns = cur_ns - this_dbs_info->prev_cpu_wall;
- this_dbs_info->prev_cpu_wall = NOW();
if (total_ns < MIN_DBS_INTERVAL)
return;
+ this_dbs_info->prev_cpu_wall = cur_ns;
+
/* Get Idle Time */
for_each_cpu(j, policy->cpus) {
uint64_t idle_ns, total_idle_ns;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.21
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |