Skip to content

Commit b99a265

Browse files
Qais YousefKAGA-KOKO
authored andcommitted
cpu/hotplug: Move bringup of secondary CPUs out of smp_init()
This is the last direct user of cpu_up() before it can become an internal implementation detail of the cpu subsystem. Signed-off-by: Qais Yousef <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 457bc8e commit b99a265

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

include/linux/cpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ void notify_cpu_starting(unsigned int cpu);
9494
extern void cpu_maps_update_begin(void);
9595
extern void cpu_maps_update_done(void);
9696
int bringup_hibernate_cpu(unsigned int sleep_cpu);
97+
void bringup_nonboot_cpus(unsigned int setup_max_cpus);
9798

9899
#else /* CONFIG_SMP */
99100
#define cpuhp_tasks_frozen 0

kernel/cpu.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,6 +1298,18 @@ int bringup_hibernate_cpu(unsigned int sleep_cpu)
12981298
return 0;
12991299
}
13001300

1301+
void bringup_nonboot_cpus(unsigned int setup_max_cpus)
1302+
{
1303+
unsigned int cpu;
1304+
1305+
for_each_present_cpu(cpu) {
1306+
if (num_online_cpus() >= setup_max_cpus)
1307+
break;
1308+
if (!cpu_online(cpu))
1309+
cpu_up(cpu);
1310+
}
1311+
}
1312+
13011313
#ifdef CONFIG_PM_SLEEP_SMP
13021314
static cpumask_var_t frozen_cpus;
13031315

kernel/smp.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -597,20 +597,13 @@ void __init setup_nr_cpu_ids(void)
597597
void __init smp_init(void)
598598
{
599599
int num_nodes, num_cpus;
600-
unsigned int cpu;
601600

602601
idle_threads_init();
603602
cpuhp_threads_init();
604603

605604
pr_info("Bringing up secondary CPUs ...\n");
606605

607-
/* FIXME: This should be done in userspace --RR */
608-
for_each_present_cpu(cpu) {
609-
if (num_online_cpus() >= setup_max_cpus)
610-
break;
611-
if (!cpu_online(cpu))
612-
cpu_up(cpu);
613-
}
606+
bringup_nonboot_cpus(setup_max_cpus);
614607

615608
num_nodes = num_online_nodes();
616609
num_cpus = num_online_cpus();

0 commit comments

Comments
 (0)