diff mbox series

[3/6] cpuidle: teo: Don't always stop tick on one state

Message ID 20240606090050.327614-4-christian.loehle@arm.com
State New
Headers show
Series cpuidle: teo: fixes and improvements | expand

Commit Message

Christian Loehle June 6, 2024, 9 a.m. UTC
Even if we have only one state, we unfortunately still need to query
expected sleep length if state0 is a proper sleep state like WFI.
This enables teo to save energy even in that scenario.

Signed-off-by: Christian Loehle <christian.loehle@arm.com>
---
 drivers/cpuidle/governors/teo.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

--
2.34.1
diff mbox series

Patch

diff --git a/drivers/cpuidle/governors/teo.c b/drivers/cpuidle/governors/teo.c
index 2c427dd4cac0..216d34747e3b 100644
--- a/drivers/cpuidle/governors/teo.c
+++ b/drivers/cpuidle/governors/teo.c
@@ -403,7 +403,14 @@  static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
 	/* Check if there is any choice in the first place. */
 	if (drv->state_count < 2) {
 		idx = 0;
-		goto out_tick;
+		if (drv->states[0].flags & CPUIDLE_FLAG_POLLING)
+			goto out_tick;
+		/*
+		 * If we only have one state and it is a proper one, check if
+		 * disabling the tick would be worth it.
+		 */
+		duration_ns = tick_nohz_get_sleep_length(&delta_tick);
+		goto end;
 	}

 	if (!dev->states_usage[0].disable)