Skip to content

Commit a03b201

Browse files
committed
cpuidle: governors: teo: Drop misguided target residency check
When the target residency of the current candidate idle state is greater than the expected time till the closest timer (the sleep length), it does not matter whether or not the tick has already been stopped or if it is going to be stopped. The closest timer will trigger anyway at its due time, so if an idle state with target residency above the sleep length is selected, energy will be wasted and there may be excess latency. Of course, if the closest timer were canceled before it could trigger, a deeper idle state would be more suitable, but this is not expected to happen (generally speaking, hrtimers are not expected to be canceled as a rule). Accordingly, the teo_state_ok() check done in that case causes energy to be wasted more often than it allows any energy to be saved (if it allows any energy to be saved at all), so drop it and let the governor use the teo_find_shallower_state() return value as the new candidate idle state index. Fixes: 21d28cd ("cpuidle: teo: Do not call tick_nohz_get_sleep_length() upfront") Cc: All applicable <stable@vger.kernel.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Christian Loehle <christian.loehle@arm.com> Tested-by: Christian Loehle <christian.loehle@arm.com> Link: https://patch.msgid.link/5955081.DvuYhMxLoT@rafael.j.wysocki
1 parent 0796ddf commit a03b201

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

  • drivers/cpuidle/governors

drivers/cpuidle/governors/teo.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,8 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
458458
* If the closest expected timer is before the target residency of the
459459
* candidate state, a shallower one needs to be found.
460460
*/
461-
if (drv->states[idx].target_residency_ns > duration_ns) {
462-
i = teo_find_shallower_state(drv, dev, idx, duration_ns, false);
463-
if (teo_state_ok(i, drv))
464-
idx = i;
465-
}
461+
if (drv->states[idx].target_residency_ns > duration_ns)
462+
idx = teo_find_shallower_state(drv, dev, idx, duration_ns, false);
466463

467464
/*
468465
* If the selected state's target residency is below the tick length

0 commit comments

Comments
 (0)