summaryrefslogtreecommitdiff
path: root/drivers/cpuidle
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2026-01-14 20:44:53 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2026-01-23 21:50:38 +0100
commit60836533b4c7b69e6cb815c87f089e39c2878acd (patch)
tree79744aa23659355df53b85a09c53f098082be7c2 /drivers/cpuidle
parent4bd2221f231d798b01027367857d9ba2f24f6ea0 (diff)
downloadlinux-next-60836533b4c7b69e6cb815c87f089e39c2878acd.tar.gz
linux-next-60836533b4c7b69e6cb815c87f089e39c2878acd.zip
cpuidle: governors: teo: Avoid fake intercepts produced by tick
Tick wakeups can lead to fake intercepts that may skew idle state selection towards shallow states, so it is better to avoid counting them as intercepts. For this purpose, add a check causing teo_update() to only count tick wakeups as intercepts if intercepts within the tick period range are at least twice as frequent as any other events. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Christian Loehle <christian.loehle@arm.com> Link: https://patch.msgid.link/3404606.44csPzL39Z@rafael.j.wysocki
Diffstat (limited to 'drivers/cpuidle')
-rw-r--r--drivers/cpuidle/governors/teo.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c
index 9820ef36a664..5434584af040 100644
--- a/drivers/cpuidle/governors/teo.c
+++ b/drivers/cpuidle/governors/teo.c
@@ -239,6 +239,17 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
cpu_data->state_bins[drv->state_count-1].hits += PULSE;
return;
}
+ /*
+ * If intercepts within the tick period range are not frequent
+ * enough, count this wakeup as a hit, since it is likely that
+ * the tick has woken up the CPU because an expected intercept
+ * was not there. Otherwise, one of the intercepts may have
+ * been incidentally preceded by the tick wakeup.
+ */
+ if (3 * cpu_data->tick_intercepts < 2 * total) {
+ cpu_data->state_bins[idx_timer].hits += PULSE;
+ return;
+ }
}
/*