aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpuidle/governors
diff options
context:
space:
mode:
authortuukka.tikkanen@linaro.org <tuukka.tikkanen@linaro.org>2014-02-24 01:29:33 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-03-05 19:45:59 -0500
commit7ac26436677024ab5e57e25c2c83d4c3fc232106 (patch)
tree8b55e630313e2aa22f1ccd304fb71bff0ee778d0 /drivers/cpuidle/governors
parent22695ab6314083d9d045ce9276e9ae79eb889531 (diff)
cpuidle: Ensure menu coefficients stay within domain
The menu governor uses coefficients as one method of actual idle period length estimation. The coefficients are, as detailed below, multipliers giving expected idle period length from time until next timer expiry. The multipliers are supposed to have domain of (0..1]. The coefficients are fractions where only the numerators are stored and denominators are a shared constant RESOLUTION*DECAY. Since the value of the coefficient should always be greater than 0 and less than or equal to 1, the numerator must have a value greater than 0 and less than or equal to RESOLUTION*DECAY. If the coefficients are updated with measured idle durations exceeding timer length, the multiplier may reach values exceeding unity (i.e. the stored numerator exceeds RESOLUTION*DECAY). This patch ensures that the multipliers are updated with durations capped to timer length. Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org> Acked-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle/governors')
-rw-r--r--drivers/cpuidle/governors/menu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index 115386a46e9e..f0995dd2469f 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -410,6 +410,9 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
410 if (measured_us > target->exit_latency) 410 if (measured_us > target->exit_latency)
411 measured_us -= target->exit_latency; 411 measured_us -= target->exit_latency;
412 412
413 /* Make sure our coefficients do not exceed unity */
414 if (measured_us > data->next_timer_us)
415 measured_us = data->next_timer_us;
413 416
414 /* Update our correction ratio */ 417 /* Update our correction ratio */
415 new_factor = data->correction_factor[data->bucket]; 418 new_factor = data->correction_factor[data->bucket];