Skip to content

Commit db86f55

Browse files
committed
cpuidle: governors: menu: Select polling state in some more cases
A throughput regression of 11% introduced by commit 779b1a1 ("cpuidle: governors: menu: Avoid selecting states with too much latency") has been reported and it is related to the case when the menu governor checks if selecting a proper idle state instead of a polling one makes sense. In particular, it is questionable to do so if the exit latency of the idle state in question exceeds the predicted idle duration, so add a check for that, which is sufficient to make the reported regression go away, and update the related code comment accordingly. Fixes: 779b1a1 ("cpuidle: governors: menu: Avoid selecting states with too much latency") Closes: https://lore.kernel.org/linux-pm/[email protected]/ Reported-by: Doug Smythies <[email protected]> Tested-by: Doug Smythies <[email protected]> Cc: All applicable <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Christian Loehle <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent dcb6fa3 commit db86f55

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • drivers/cpuidle/governors

drivers/cpuidle/governors/menu.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,13 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
318318

319319
/*
320320
* Use a physical idle state, not busy polling, unless a timer
321-
* is going to trigger soon enough.
321+
* is going to trigger soon enough or the exit latency of the
322+
* idle state in question is greater than the predicted idle
323+
* duration.
322324
*/
323325
if ((drv->states[idx].flags & CPUIDLE_FLAG_POLLING) &&
324-
s->target_residency_ns <= data->next_timer_ns) {
326+
s->target_residency_ns <= data->next_timer_ns &&
327+
s->exit_latency_ns <= predicted_ns) {
325328
predicted_ns = s->target_residency_ns;
326329
idx = i;
327330
break;

0 commit comments

Comments
 (0)