Skip to content

cpuidle: Take possible negative "sleep length" values into account

Rafael J. Wysocki linux-pm lkml 1 version In review

Get series with b4
b4 am 2764850.e9J7NaK4W3@kreacher

Versions newest first

  1. v1 Latest5 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5tick/nohz: Improve tick_nohz_get_next_hrtimer() kerneldockernel/time/tick-sched.c+5 -10 replies
2/5cpuidle: Use s64 as exit_latency_ns and target_residency_ns data typedrivers/cpuidle/driver.c include/linux/cpuidle.h+6 -20 replies
3/5cpuidle: teo: Adjust handling of very short idle timesdrivers/cpuidle/governors/teo.c+15 -170 replies
4/5cpuidle: teo: Take negative "sleep length" values into accountdrivers/cpuidle/governors/teo.c+15 -70 replies
5/5cpuidle: menu: Take negative "sleep length" values into accountdrivers/cpuidle/governors/menu.c+11 -62 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH v1 0/5] cpuidle: Take possible negative "sleep length" values into account

Hi All,

As follows from the discussion triggered by the patch at

https://lore.kernel.org/lkml/[email protected]/

the cpuidle governors using tick_nohz_get_sleep_length() assume it to always return positive values which is not correct in general.

To address this issues, first document the fact that negative values can be returned by tick_nohz_get_sleep_length() (patch [1/5]). Then, in preparation for more substantial changes, change the data type of two fields in struct cpuidle_state to s64 so they can be used in computations involving negative numbers safely (patch [2/5]).

Next, adjust the teo governor a bit so that negative "sleep length" values are counted like zero by it (patch [3/5]) and modify it so as to avoid mishandling negative "sleep length" values (patch [4/5]).

Finally, make the menu governor take negative "sleep length" values into account properly (patch [5/5]).

Please see the changelogs of the patches for details.

Thanks!