aboutsummaryrefslogtreecommitdiffstats
path: root/init/calibrate.c
diff options
context:
space:
mode:
authorSameer Nanda <snanda@chromium.org>2011-07-25 20:13:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-07-25 23:57:17 -0400
commit7afe1845dd1e7c90828c942daed7e57ffa7c38d6 (patch)
treedabdded21b9d03cf04719b684e393929378f6c8d /init/calibrate.c
parent469dded1839105cfbfc265376e23e24dbc48d2a7 (diff)
init: skip calibration delay if previously done
For each CPU, do the calibration delay only once. For subsequent calls, use the cached per-CPU value of loops_per_jiffy. This saves about 200ms of resume time on dual core Intel Atom N5xx based systems. This helps bring down the kernel resume time on such systems from about 500ms to about 300ms. [akpm@linux-foundation.org: make cpu_loops_per_jiffy static] [akpm@linux-foundation.org: clean up message text] [akpm@linux-foundation.org: fix things up after upstream rmk changes] Signed-off-by: Sameer Nanda <snanda@chromium.org> Cc: Phil Carmody <ext-phil.2.carmody@nokia.com> Cc: Andrew Worsley <amworsley@gmail.com> Cc: David Daney <ddaney@caviumnetworks.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'init/calibrate.c')
-rw-r--r--init/calibrate.c11
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
13unsigned long lpj_fine; 14unsigned long lpj_fine;
14unsigned long preset_lpj; 15unsigned long preset_lpj;
@@ -243,12 +244,19 @@ recalibrate:
243 return lpj; 244 return lpj;
244} 245}
245 246
247static DEFINE_PER_CPU(unsigned long, cpu_loops_per_jiffy) = { 0 };
248
246void __cpuinit calibrate_delay(void) 249void __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),