Date: | 2009-09-22 02:04:09 (14 years 6 days ago) |
---|---|
Author: | Corrado Zoccolo |
Commit: | 672917dcc781ead7652a8b11b1fba14e38ac15b8 |
Message: | cpuidle: menu governor: reduce latency on exit Move the state residency accounting and statistics computation off the hot exit path. On exit, the need to recompute statistics is recorded, and new statistics will be computed when menu_select is called again. The expected effect is to reduce processor wakeup latency from sleep (C-states). We are speaking of few hundreds of cycles reduction out of a several microseconds latency (determined by the hardware transition), so it is difficult to measure. Signed-off-by: Corrado Zoccolo <czoccolo@gmail.com> Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Cc: Len Brown <len.brown@intel.com> Cc: Adam Belay <abelay@novell.com Acked-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> |
Files: |
drivers/cpuidle/governors/menu.c (5 diffs) |
Change Details
drivers/cpuidle/governors/menu.c | ||
---|---|---|
96 | 96 | |
97 | 97 | struct menu_device { |
98 | 98 | int last_state_idx; |
99 | int needs_update; | |
99 | 100 | |
100 | 101 | unsigned int expected_us; |
101 | 102 | u64 predicted_us; |
... | ... | |
166 | 167 | |
167 | 168 | static DEFINE_PER_CPU(struct menu_device, menu_devices); |
168 | 169 | |
170 | static void menu_update(struct cpuidle_device *dev); | |
171 | ||
169 | 172 | /** |
170 | 173 | * menu_select - selects the next idle state to enter |
171 | 174 | * @dev: the CPU |
... | ... | |
180 | 183 | data->last_state_idx = 0; |
181 | 184 | data->exit_us = 0; |
182 | 185 | |
186 | if (data->needs_update) { | |
187 | menu_update(dev); | |
188 | data->needs_update = 0; | |
189 | } | |
190 | ||
183 | 191 | /* Special case when user has set very strict latency requirement */ |
184 | 192 | if (unlikely(latency_req == 0)) |
185 | 193 | return 0; |
... | ... | |
231 | 239 | } |
232 | 240 | |
233 | 241 | /** |
234 | * menu_reflect - attempts to guess what happened after entry | |
242 | * menu_reflect - records that data structures need update | |
235 | 243 | * @dev: the CPU |
236 | 244 | * |
237 | 245 | * NOTE: it's important to be fast here because this operation will add to |
... | ... | |
240 | 248 | static void menu_reflect(struct cpuidle_device *dev) |
241 | 249 | { |
242 | 250 | struct menu_device *data = &__get_cpu_var(menu_devices); |
251 | data->needs_update = 1; | |
252 | } | |
253 | ||
254 | /** | |
255 | * menu_update - attempts to guess what happened after entry | |
256 | * @dev: the CPU | |
257 | */ | |
258 | static void menu_update(struct cpuidle_device *dev) | |
259 | { | |
260 | struct menu_device *data = &__get_cpu_var(menu_devices); | |
243 | 261 | int last_idx = data->last_state_idx; |
244 | 262 | unsigned int last_idle_us = cpuidle_get_last_residency(dev); |
245 | 263 | struct cpuidle_state *target = &dev->states[last_idx]; |
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