[PATCH 1/6] cpuidle: teo: Increase util-threshold

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


Increase the util-threshold by a lot as it was low enough for some
minor load to always be active, especially on smaller CPUs.

For small cap CPUs (Pixel6) the util threshold is as low as 1.
For CPUs of capacity <64 it is 0. So ensure it is at a minimum, too.

Fixes: 9ce0f7c4bc64 ("cpuidle: teo: Introduce util-awareness")
Reported-by: Qais Yousef <qyousef@xxxxxxxxxxx>
Reported-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Suggested-by: Kajetan Puchalski <kajetan.puchalski@xxxxxxx>
Signed-off-by: Christian Loehle <christian.loehle@xxxxxxx>
---
drivers/cpuidle/governors/teo.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c
index 7244f71c59c5..45f43e2ee02d 100644
--- a/drivers/cpuidle/governors/teo.c
+++ b/drivers/cpuidle/governors/teo.c
@@ -146,13 +146,11 @@
* The number of bits to shift the CPU's capacity by in order to determine
* the utilized threshold.
*
- * 6 was chosen based on testing as the number that achieved the best balance
- * of power and performance on average.
- *
* The resulting threshold is high enough to not be triggered by background
- * noise and low enough to react quickly when activity starts to ramp up.
+ * noise.
*/
-#define UTIL_THRESHOLD_SHIFT 6
+#define UTIL_THRESHOLD_SHIFT 2
+#define UTIL_THRESHOLD_MIN 50

/*
* The PULSE value is added to metrics when they grow and the DECAY_SHIFT value
@@ -671,7 +669,8 @@ static int teo_enable_device(struct cpuidle_driver *drv,
int i;

memset(cpu_data, 0, sizeof(*cpu_data));
- cpu_data->util_threshold = max_capacity >> UTIL_THRESHOLD_SHIFT;
+ cpu_data->util_threshold = max(UTIL_THRESHOLD_MIN,
+ max_capacity >> UTIL_THRESHOLD_SHIFT);

for (i = 0; i < NR_RECENT; i++)
cpu_data->recent_idx[i] = -1;
--
2.34.1