Skip to content

Commit ea18540

Browse files
committed
cpuidle: teo: Combine candidate state index checks against 0
There are two candidate state index checks against 0 in teo_select() that need not be separate, so combine them and update comments around them. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Christian Loehle <[email protected]> Tested-by: Aboorva Devarajan <[email protected]> Tested-by: Christian Loehle <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 92ce5c0 commit ea18540

File tree

1 file changed

+9
-14
lines changed
  • drivers/cpuidle/governors

1 file changed

+9
-14
lines changed

drivers/cpuidle/governors/teo.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -436,23 +436,18 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
436436
if (idx > constraint_idx)
437437
idx = constraint_idx;
438438

439-
if (!idx && prev_intercept_idx) {
440-
/*
441-
* We have to query the sleep length here otherwise we don't
442-
* know after wakeup if our guess was correct.
443-
*/
444-
duration_ns = tick_nohz_get_sleep_length(&delta_tick);
445-
cpu_data->sleep_length_ns = duration_ns;
439+
if (!idx) {
440+
if (prev_intercept_idx) {
441+
/*
442+
* Query the sleep length to be able to count the wakeup
443+
* as a hit if it is caused by a timer.
444+
*/
445+
duration_ns = tick_nohz_get_sleep_length(&delta_tick);
446+
cpu_data->sleep_length_ns = duration_ns;
447+
}
446448
goto out_tick;
447449
}
448450

449-
/*
450-
* Skip the timers check if state 0 is the current candidate one,
451-
* because an immediate non-timer wakeup is expected in that case.
452-
*/
453-
if (!idx)
454-
goto out_tick;
455-
456451
/*
457452
* If state 0 is a polling one, check if the target residency of
458453
* the current candidate state is low enough and skip the timers

0 commit comments

Comments
 (0)