Skip to content

Commit e24f8a5

Browse files
committed
cpuidle: teo: Clarify two code comments
Rewrite two code comments suposed to explain its behavior that are too concise or not sufficiently clear. No 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] [ rjw: Fixed 2 typos in new comments ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent b9a6af2 commit e24f8a5

File tree

1 file changed

+11
-5
lines changed
  • drivers/cpuidle/governors

1 file changed

+11
-5
lines changed

drivers/cpuidle/governors/teo.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@ static void teo_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
154154

155155
if (cpu_data->time_span_ns >= cpu_data->sleep_length_ns) {
156156
/*
157-
* One of the safety nets has triggered or the wakeup was close
158-
* enough to the closest timer event expected at the idle state
159-
* selection time to be discarded.
157+
* This causes the wakeup to be counted as a hit regardless of
158+
* the real idle duration which doesn't need to be computed
159+
* because the wakeup has been close enough to an anticipated
160+
* timer.
160161
*/
161162
measured_ns = U64_MAX;
162163
} else {
@@ -302,8 +303,13 @@ static int teo_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
302303

303304
cpu_data->time_span_ns = local_clock();
304305
/*
305-
* Set the expected sleep length to infinity in case of an early
306-
* return.
306+
* Set the sleep length to infinity in case the invocation of
307+
* tick_nohz_get_sleep_length() below is skipped, in which case it won't
308+
* be known whether or not the subsequent wakeup is caused by a timer.
309+
* It is generally fine to count the wakeup as an intercept then, except
310+
* for the cases when the CPU is mostly woken up by timers and there may
311+
* be opportunities to ask for a deeper idle state when no imminent
312+
* timers are scheduled which may be missed.
307313
*/
308314
cpu_data->sleep_length_ns = KTIME_MAX;
309315

0 commit comments

Comments
 (0)