diff options
Diffstat (limited to 'init/calibrate.c')
-rw-r--r-- | init/calibrate.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/init/calibrate.c b/init/calibrate.c index aae2f40fea4c..24df7976816c 100644 --- a/init/calibrate.c +++ b/init/calibrate.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/timex.h> | 10 | #include <linux/timex.h> |
11 | #include <linux/smp.h> | 11 | #include <linux/smp.h> |
12 | #include <linux/percpu.h> | ||
12 | 13 | ||
13 | unsigned long lpj_fine; | 14 | unsigned long lpj_fine; |
14 | unsigned long preset_lpj; | 15 | unsigned long preset_lpj; |
@@ -243,12 +244,19 @@ recalibrate: | |||
243 | return lpj; | 244 | return lpj; |
244 | } | 245 | } |
245 | 246 | ||
247 | static DEFINE_PER_CPU(unsigned long, cpu_loops_per_jiffy) = { 0 }; | ||
248 | |||
246 | void __cpuinit calibrate_delay(void) | 249 | void __cpuinit calibrate_delay(void) |
247 | { | 250 | { |
248 | unsigned long lpj; | 251 | unsigned long lpj; |
249 | static bool printed; | 252 | static bool printed; |
253 | int this_cpu = smp_processor_id(); | ||
250 | 254 | ||
251 | if (preset_lpj) { | 255 | if (per_cpu(cpu_loops_per_jiffy, this_cpu)) { |
256 | lpj = per_cpu(cpu_loops_per_jiffy, this_cpu); | ||
257 | pr_info("Calibrating delay loop (skipped) " | ||
258 | "already calibrated this CPU"); | ||
259 | } else if (preset_lpj) { | ||
252 | lpj = preset_lpj; | 260 | lpj = preset_lpj; |
253 | if (!printed) | 261 | if (!printed) |
254 | pr_info("Calibrating delay loop (skipped) " | 262 | pr_info("Calibrating delay loop (skipped) " |
@@ -266,6 +274,7 @@ void __cpuinit calibrate_delay(void) | |||
266 | pr_info("Calibrating delay loop... "); | 274 | pr_info("Calibrating delay loop... "); |
267 | lpj = calibrate_delay_converge(); | 275 | lpj = calibrate_delay_converge(); |
268 | } | 276 | } |
277 | per_cpu(cpu_loops_per_jiffy, this_cpu) = lpj; | ||
269 | if (!printed) | 278 | if (!printed) |
270 | pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n", | 279 | pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n", |
271 | lpj/(500000/HZ), | 280 | lpj/(500000/HZ), |