diff options
author | Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com> | 2012-05-24 11:10:55 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2012-05-24 16:58:08 -0400 |
commit | ee74d13229fb606353ff56f4927fa93b37e95bbe (patch) | |
tree | 6cfc806db818bdc739c5a46d41e2c81c96364463 /kernel/smpboot.c | |
parent | f9369910a6225b8d4892c3f20ae740a711cd5ace (diff) |
smpboot, idle: Optimize calls to smp_processor_id() in idle_threads_init()
While trying to initialize idle threads for all cpus, idle_threads_init()
calls smp_processor_id() in a loop, which is unnecessary. The intent
is to initialize idle threads for all non-boot cpus. So just use a variable
to note the boot cpu and use it in the loop.
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Cc: suresh.b.siddha@intel.com
Cc: venki@google.com
Cc: nikunj@linux.vnet.ibm.com
Link: http://lkml.kernel.org/r/20120524151055.2549.64309.stgit@srivatsabhat.in.ibm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/smpboot.c')
-rw-r--r-- | kernel/smpboot.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/smpboot.c b/kernel/smpboot.c index e1a797e028a3..0f2162f808a7 100644 --- a/kernel/smpboot.c +++ b/kernel/smpboot.c | |||
@@ -52,10 +52,12 @@ static inline void idle_init(unsigned int cpu) | |||
52 | */ | 52 | */ |
53 | void __init idle_threads_init(void) | 53 | void __init idle_threads_init(void) |
54 | { | 54 | { |
55 | unsigned int cpu; | 55 | unsigned int cpu, boot_cpu; |
56 | |||
57 | boot_cpu = smp_processor_id(); | ||
56 | 58 | ||
57 | for_each_possible_cpu(cpu) { | 59 | for_each_possible_cpu(cpu) { |
58 | if (cpu != smp_processor_id()) | 60 | if (cpu != boot_cpu) |
59 | idle_init(cpu); | 61 | idle_init(cpu); |
60 | } | 62 | } |
61 | } | 63 | } |