diff options
-rw-r--r-- | drivers/cpuidle/governors/menu.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index ba6df6044fff..f55d8260ec43 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -142,7 +142,7 @@ static int get_loadavg(void) | |||
142 | return LOAD_INT(this) * 10 + LOAD_FRAC(this) / 10; | 142 | return LOAD_INT(this) * 10 + LOAD_FRAC(this) / 10; |
143 | } | 143 | } |
144 | 144 | ||
145 | static inline int which_bucket(unsigned int duration) | 145 | static inline int which_bucket(unsigned int duration, unsigned long nr_iowaiters) |
146 | { | 146 | { |
147 | int bucket = 0; | 147 | int bucket = 0; |
148 | 148 | ||
@@ -152,7 +152,7 @@ static inline int which_bucket(unsigned int duration) | |||
152 | * This allows us to calculate | 152 | * This allows us to calculate |
153 | * E(duration)|iowait | 153 | * E(duration)|iowait |
154 | */ | 154 | */ |
155 | if (nr_iowait_cpu(smp_processor_id())) | 155 | if (nr_iowaiters) |
156 | bucket = BUCKETS/2; | 156 | bucket = BUCKETS/2; |
157 | 157 | ||
158 | if (duration < 10) | 158 | if (duration < 10) |
@@ -175,7 +175,7 @@ static inline int which_bucket(unsigned int duration) | |||
175 | * to be, the higher this multiplier, and thus the higher | 175 | * to be, the higher this multiplier, and thus the higher |
176 | * the barrier to go to an expensive C state. | 176 | * the barrier to go to an expensive C state. |
177 | */ | 177 | */ |
178 | static inline int performance_multiplier(void) | 178 | static inline int performance_multiplier(unsigned long nr_iowaiters) |
179 | { | 179 | { |
180 | int mult = 1; | 180 | int mult = 1; |
181 | 181 | ||
@@ -184,7 +184,7 @@ static inline int performance_multiplier(void) | |||
184 | mult += 2 * get_loadavg(); | 184 | mult += 2 * get_loadavg(); |
185 | 185 | ||
186 | /* for IO wait tasks (per cpu!) we add 5x each */ | 186 | /* for IO wait tasks (per cpu!) we add 5x each */ |
187 | mult += 10 * nr_iowait_cpu(smp_processor_id()); | 187 | mult += 10 * nr_iowaiters; |
188 | 188 | ||
189 | return mult; | 189 | return mult; |
190 | } | 190 | } |
@@ -296,6 +296,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
296 | int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); | 296 | int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY); |
297 | int i; | 297 | int i; |
298 | unsigned int interactivity_req; | 298 | unsigned int interactivity_req; |
299 | unsigned long nr_iowaiters; | ||
299 | 300 | ||
300 | if (data->needs_update) { | 301 | if (data->needs_update) { |
301 | menu_update(drv, dev); | 302 | menu_update(drv, dev); |
@@ -311,8 +312,8 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
311 | /* determine the expected residency time, round up */ | 312 | /* determine the expected residency time, round up */ |
312 | data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length()); | 313 | data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length()); |
313 | 314 | ||
314 | 315 | nr_iowaiters = nr_iowait_cpu(smp_processor_id()); | |
315 | data->bucket = which_bucket(data->next_timer_us); | 316 | data->bucket = which_bucket(data->next_timer_us, nr_iowaiters); |
316 | 317 | ||
317 | /* | 318 | /* |
318 | * Force the result of multiplication to be 64 bits even if both | 319 | * Force the result of multiplication to be 64 bits even if both |
@@ -330,7 +331,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) | |||
330 | * duration / latency ratio. Adjust the latency limit if | 331 | * duration / latency ratio. Adjust the latency limit if |
331 | * necessary. | 332 | * necessary. |
332 | */ | 333 | */ |
333 | interactivity_req = data->predicted_us / performance_multiplier(); | 334 | interactivity_req = data->predicted_us / performance_multiplier(nr_iowaiters); |
334 | if (latency_req > interactivity_req) | 335 | if (latency_req > interactivity_req) |
335 | latency_req = interactivity_req; | 336 | latency_req = interactivity_req; |
336 | 337 | ||