Date: | 2010-05-09 00:47:37 (13 years 4 months ago) |
---|---|
Author: | Arjan van de Ven |
Commit: | 1c6fe0364fa7bf28248488753ee0afb6b759cd04 |
Message: | cpuidle: Fix incorrect optimization commit 672917dcc78 ("cpuidle: menu governor: reduce latency on exit") added an optimization, where the analysis on the past idle period moved from the end of idle, to the beginning of the new idle. Unfortunately, this optimization had a bug where it zeroed one key variable for new use, that is needed for the analysis. The fix is simple, zero the variable after doing the work from the previous idle. During the audit of the code that found this issue, another issue was also found; the ->measured_us data structure member is never set, a local variable is always used instead. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Cc: Corrado Zoccolo <czoccolo@gmail.com> Cc: stable@kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> |
Files: |
drivers/cpuidle/governors/menu.c (3 diffs) |
Change Details
drivers/cpuidle/governors/menu.c | ||
---|---|---|
100 | 100 | int needs_update; |
101 | 101 | |
102 | 102 | unsigned int expected_us; |
103 | unsigned int measured_us; | |
104 | 103 | u64 predicted_us; |
105 | 104 | unsigned int exit_us; |
106 | 105 | unsigned int bucket; |
... | ... | |
187 | 186 | int i; |
188 | 187 | int multiplier; |
189 | 188 | |
190 | data->last_state_idx = 0; | |
191 | data->exit_us = 0; | |
192 | ||
193 | 189 | if (data->needs_update) { |
194 | 190 | menu_update(dev); |
195 | 191 | data->needs_update = 0; |
196 | 192 | } |
197 | 193 | |
194 | data->last_state_idx = 0; | |
195 | data->exit_us = 0; | |
196 | ||
198 | 197 | /* Special case when user has set very strict latency requirement */ |
199 | 198 | if (unlikely(latency_req == 0)) |
200 | 199 | return 0; |
... | ... | |
294 | 293 | new_factor = data->correction_factor[data->bucket] |
295 | 294 | * (DECAY - 1) / DECAY; |
296 | 295 | |
297 | if (data->expected_us > 0 && data->measured_us < MAX_INTERESTING) | |
296 | if (data->expected_us > 0 && measured_us < MAX_INTERESTING) | |
298 | 297 | new_factor += RESOLUTION * measured_us / data->expected_us; |
299 | 298 | else |
300 | 299 | /* |
Branches:
ben-wpan
ben-wpan-stefan
5396a9238205f20f811ea57898980d3ca82df0b6
jz-2.6.34
jz-2.6.34-rc5
jz-2.6.34-rc6
jz-2.6.34-rc7
jz-2.6.35
jz-2.6.36
jz-2.6.37
jz-2.6.38
jz-2.6.39
jz-3.0
jz-3.1
jz-3.11
jz-3.12
jz-3.13
jz-3.15
jz-3.16
jz-3.18-dt
jz-3.2
jz-3.3
jz-3.4
jz-3.5
jz-3.6
jz-3.6-rc2-pwm
jz-3.9
jz-3.9-clk
jz-3.9-rc8
jz47xx
jz47xx-2.6.38
master
Tags:
od-2011-09-04
od-2011-09-18
v2.6.34-rc5
v2.6.34-rc6
v2.6.34-rc7
v3.9