Skip to content

Commit ee74d13

Browse files
Srivatsa S. BhatKAGA-KOKO
authored andcommitted
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 <[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]>
1 parent f936991 commit ee74d13

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

kernel/smpboot.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ static inline void idle_init(unsigned int cpu)
5252
*/
5353
void __init idle_threads_init(void)
5454
{
55-
unsigned int cpu;
55+
unsigned int cpu, boot_cpu;
56+
57+
boot_cpu = smp_processor_id();
5658

5759
for_each_possible_cpu(cpu) {
58-
if (cpu != smp_processor_id())
60+
if (cpu != boot_cpu)
5961
idle_init(cpu);
6062
}
6163
}

0 commit comments

Comments
 (0)