]> git.openfabrics.org - ~shefty/rdma-dev.git/blobdiff - init/calibrate.c
init: skip calibration delay if previously done
[~shefty/rdma-dev.git] / init / calibrate.c
index aae2f40fea4cbea200f0658c7f6afddb60f1d934..24df7976816c6ca99f3403f97444f8e49f69a0a7 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/init.h>
 #include <linux/timex.h>
 #include <linux/smp.h>
+#include <linux/percpu.h>
 
 unsigned long lpj_fine;
 unsigned long preset_lpj;
@@ -243,12 +244,19 @@ recalibrate:
        return lpj;
 }
 
+static DEFINE_PER_CPU(unsigned long, cpu_loops_per_jiffy) = { 0 };
+
 void __cpuinit calibrate_delay(void)
 {
        unsigned long lpj;
        static bool printed;
+       int this_cpu = smp_processor_id();
 
-       if (preset_lpj) {
+       if (per_cpu(cpu_loops_per_jiffy, this_cpu)) {
+               lpj = per_cpu(cpu_loops_per_jiffy, this_cpu);
+               pr_info("Calibrating delay loop (skipped) "
+                               "already calibrated this CPU");
+       } else if (preset_lpj) {
                lpj = preset_lpj;
                if (!printed)
                        pr_info("Calibrating delay loop (skipped) "
@@ -266,6 +274,7 @@ void __cpuinit calibrate_delay(void)
                        pr_info("Calibrating delay loop... ");
                lpj = calibrate_delay_converge();
        }
+       per_cpu(cpu_loops_per_jiffy, this_cpu) = lpj;
        if (!printed)
                pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n",
                        lpj/(500000/HZ),