Skip to content

Commit

Permalink
smpboot, idle: Optimize calls to smp_processor_id() in idle_threads_i…
Browse files Browse the repository at this point in the history
…nit()

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 <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
  • Loading branch information
Srivatsa S. Bhat authored and KAGA-KOKO committed May 24, 2012
1 parent f936991 commit ee74d13
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/smpboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,12 @@ static inline void idle_init(unsigned int cpu)
*/
void __init idle_threads_init(void)
{
unsigned int cpu;
unsigned int cpu, boot_cpu;

boot_cpu = smp_processor_id();

for_each_possible_cpu(cpu) {
if (cpu != smp_processor_id())
if (cpu != boot_cpu)
idle_init(cpu);
}
}
Expand Down

0 comments on commit ee74d13

Please sign in to comment.