aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/governors/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpuidle/governors/menu.c')
-rw-r--r--drivers/cpuidle/governors/menu.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index cf7f2f0e4ef5..e9a2a27134c1 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -122,7 +122,7 @@ struct menu_device {
122 int last_state_idx; 122 int last_state_idx;
123 int needs_update; 123 int needs_update;
124 124
125 unsigned int expected_us; 125 unsigned int next_timer_us;
126 unsigned int predicted_us; 126 unsigned int predicted_us;
127 unsigned int exit_us; 127 unsigned int exit_us;
128 unsigned int bucket; 128 unsigned int bucket;
@@ -257,7 +257,7 @@ again:
257 stddev = int_sqrt(stddev); 257 stddev = int_sqrt(stddev);
258 if (((avg > stddev * 6) && (divisor * 4 >= INTERVALS * 3)) 258 if (((avg > stddev * 6) && (divisor * 4 >= INTERVALS * 3))
259 || stddev <= 20) { 259 || stddev <= 20) {
260 if (data->expected_us > avg) 260 if (data->next_timer_us > avg)
261 data->predicted_us = avg; 261 data->predicted_us = avg;
262 return; 262 return;
263 } 263 }
@@ -306,11 +306,11 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
306 306
307 /* determine the expected residency time, round up */ 307 /* determine the expected residency time, round up */
308 t = ktime_to_timespec(tick_nohz_get_sleep_length()); 308 t = ktime_to_timespec(tick_nohz_get_sleep_length());
309 data->expected_us = 309 data->next_timer_us =
310 t.tv_sec * USEC_PER_SEC + t.tv_nsec / NSEC_PER_USEC; 310 t.tv_sec * USEC_PER_SEC + t.tv_nsec / NSEC_PER_USEC;
311 311
312 312
313 data->bucket = which_bucket(data->expected_us); 313 data->bucket = which_bucket(data->next_timer_us);
314 314
315 multiplier = performance_multiplier(); 315 multiplier = performance_multiplier();
316 316
@@ -326,7 +326,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
326 * operands are 32 bits. 326 * operands are 32 bits.
327 * Make sure to round up for half microseconds. 327 * Make sure to round up for half microseconds.
328 */ 328 */
329 data->predicted_us = div_round64((uint64_t)data->expected_us * 329 data->predicted_us = div_round64((uint64_t)data->next_timer_us *
330 data->correction_factor[data->bucket], 330 data->correction_factor[data->bucket],
331 RESOLUTION * DECAY); 331 RESOLUTION * DECAY);
332 332
@@ -336,7 +336,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
336 * We want to default to C1 (hlt), not to busy polling 336 * We want to default to C1 (hlt), not to busy polling
337 * unless the timer is happening really really soon. 337 * unless the timer is happening really really soon.
338 */ 338 */
339 if (data->expected_us > 5 && 339 if (data->next_timer_us > 5 &&
340 !drv->states[CPUIDLE_DRIVER_STATE_START].disabled && 340 !drv->states[CPUIDLE_DRIVER_STATE_START].disabled &&
341 dev->states_usage[CPUIDLE_DRIVER_STATE_START].disable == 0) 341 dev->states_usage[CPUIDLE_DRIVER_STATE_START].disable == 0)
342 data->last_state_idx = CPUIDLE_DRIVER_STATE_START; 342 data->last_state_idx = CPUIDLE_DRIVER_STATE_START;
@@ -401,7 +401,7 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
401 * for the whole expected time. 401 * for the whole expected time.
402 */ 402 */
403 if (unlikely(!(target->flags & CPUIDLE_FLAG_TIME_VALID))) 403 if (unlikely(!(target->flags & CPUIDLE_FLAG_TIME_VALID)))
404 last_idle_us = data->expected_us; 404 last_idle_us = data->next_timer_us;
405 405
406 406
407 measured_us = last_idle_us; 407 measured_us = last_idle_us;
@@ -418,8 +418,8 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
418 new_factor = data->correction_factor[data->bucket]; 418 new_factor = data->correction_factor[data->bucket];
419 new_factor -= new_factor / DECAY; 419 new_factor -= new_factor / DECAY;
420 420
421 if (data->expected_us > 0 && measured_us < MAX_INTERESTING) 421 if (data->next_timer_us > 0 && measured_us < MAX_INTERESTING)
422 new_factor += RESOLUTION * measured_us / data->expected_us; 422 new_factor += RESOLUTION * measured_us / data->next_timer_us;
423 else 423 else
424 /* 424 /*
425 * we were idle so long that we count it as a perfect 425 * we were idle so long that we count it as a perfect