diff options
author | Ingo Molnar <mingo@elte.hu> | 2010-02-08 02:55:43 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-02-08 02:55:46 -0500 |
commit | 6d3e0907b8b239d16720d144e2675ecf10d3bc3b (patch) | |
tree | e0b0743b5f6f82b057cafc4f3687396a6e01a0b4 /drivers/cpuidle/governors | |
parent | 23577256953c870de9b724c3a2611ce7be6a1e4e (diff) | |
parent | 50200df462023b187d80a99a52f5f2cfe3c86c26 (diff) |
Merge branch 'sched/urgent' into sched/core
Merge reason: Merge dependent fix, update to latest -rc.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/cpuidle/governors')
-rw-r--r-- | drivers/cpuidle/governors/menu.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 68104434ebb5..73655aeb3a60 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/hrtimer.h> | 18 | #include <linux/hrtimer.h> |
19 | #include <linux/tick.h> | 19 | #include <linux/tick.h> |
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/math64.h> | ||
21 | 22 | ||
22 | #define BUCKETS 12 | 23 | #define BUCKETS 12 |
23 | #define RESOLUTION 1024 | 24 | #define RESOLUTION 1024 |
@@ -169,6 +170,12 @@ static DEFINE_PER_CPU(struct menu_device, menu_devices); | |||
169 | 170 | ||
170 | static void menu_update(struct cpuidle_device *dev); | 171 | static void menu_update(struct cpuidle_device *dev); |
171 | 172 | ||
173 | /* This implements DIV_ROUND_CLOSEST but avoids 64 bit division */ | ||
174 | static u64 div_round64(u64 dividend, u32 divisor) | ||
175 | { | ||
176 | return div_u64(dividend + (divisor / 2), divisor); | ||
177 | } | ||
178 | |||
172 | /** | 179 | /** |
173 | * menu_select - selects the next idle state to enter | 180 | * menu_select - selects the next idle state to enter |
174 | * @dev: the CPU | 181 | * @dev: the CPU |
@@ -209,9 +216,8 @@ static int menu_select(struct cpuidle_device *dev) | |||
209 | data->correction_factor[data->bucket] = RESOLUTION * DECAY; | 216 | data->correction_factor[data->bucket] = RESOLUTION * DECAY; |
210 | 217 | ||
211 | /* Make sure to round up for half microseconds */ | 218 | /* Make sure to round up for half microseconds */ |
212 | data->predicted_us = DIV_ROUND_CLOSEST( | 219 | data->predicted_us = div_round64(data->expected_us * data->correction_factor[data->bucket], |
213 | data->expected_us * data->correction_factor[data->bucket], | 220 | RESOLUTION * DECAY); |
214 | RESOLUTION * DECAY); | ||
215 | 221 | ||
216 | /* | 222 | /* |
217 | * We want to default to C1 (hlt), not to busy polling | 223 | * We want to default to C1 (hlt), not to busy polling |