lkml.org 
[lkml]   [2011]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] init: skip calibration delay if previously done
Date
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.

Signed-off-by: Sameer Nanda <snanda@chromium.org>
---
init/calibrate.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/init/calibrate.c b/init/calibrate.c
index 76ac919..47d3408 100644
--- a/init/calibrate.c
+++ b/init/calibrate.c
@@ -183,11 +183,18 @@ recalibrate:
return lpj;
}

+DEFINE_PER_CPU(unsigned long, cpu_loops_per_jiffy) = { 0 };
+
void __cpuinit calibrate_delay(void)
{
static bool printed;
+ int this_cpu = smp_processor_id();

- if (preset_lpj) {
+ if (per_cpu(cpu_loops_per_jiffy, this_cpu)) {
+ loops_per_jiffy = per_cpu(cpu_loops_per_jiffy, this_cpu);
+ pr_info("Calibrating delay loop (skipped) "
+ "already calibrated this CPU previously.. ");
+ } else if (preset_lpj) {
loops_per_jiffy = preset_lpj;
if (!printed)
pr_info("Calibrating delay loop (skipped) "
@@ -205,6 +212,7 @@ void __cpuinit calibrate_delay(void)
pr_info("Calibrating delay loop... ");
loops_per_jiffy = calibrate_delay_converge();
}
+ per_cpu(cpu_loops_per_jiffy, this_cpu) = loops_per_jiffy;
if (!printed)
pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n",
loops_per_jiffy/(500000/HZ),
--
1.7.3.1


\
 
 \ /
  Last update: 2011-05-25 01:23    [W:0.045 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site