Commit 7afe1845 authored by Sameer Nanda's avatar Sameer Nanda Committed by Linus Torvalds

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.

[ make cpu_loops_per_jiffy static]
[ clean up message text]
[ fix things up after upstream rmk changes]
Signed-off-by: default avatarSameer Nanda <>
Cc: Phil Carmody <>
Cc: Andrew Worsley <>
Cc: David Daney <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 469dded1
......@@ -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 @@ static unsigned long __cpuinit calibrate_delay_converge(void)
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",
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment