[PATCH 4/6] cpuidle: teo: Increase minimum time to stop tick

From: Christian Loehle
Date: Thu Jun 06 2024 - 05:06:44 EST


Since stopping the tick isn't free, add at least some minor constant
(1ms) for the threshold to stop the tick.

Signed-off-by: Christian Loehle <christian.loehle@xxxxxxx>
---
drivers/cpuidle/governors/teo.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c
index 216d34747e3b..ca9422bbd8db 100644
--- a/drivers/cpuidle/governors/teo.c
+++ b/drivers/cpuidle/governors/teo.c
@@ -622,10 +622,10 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
/*
* Allow the tick to be stopped unless the selected state is a polling
* one or the expected idle duration is shorter than the tick period
- * length.
+ * length plus some constant (1ms) to account for stopping it.
*/
if ((!(drv->states[idx].flags & CPUIDLE_FLAG_POLLING) &&
- duration_ns >= TICK_NSEC) || tick_nohz_tick_stopped())
+ duration_ns > NSEC_PER_MSEC + TICK_NSEC) || tick_nohz_tick_stopped())
return idx;

out_tick_state:
--
2.34.1