Skip to content

Commit 0f3f506

Browse files
chenhuacairalfbaechle
authored andcommitted
MIPS: Support hard limit of cpu count (nr_cpu_ids)
On MIPS currently, only the soft limit of cpu count (maxcpus) has its effect, this patch enable the hard limit (nr_cpus) as well. Processor cores which greater than maxcpus and less than nr_cpus can be taken up via cpu hotplug. The code is borrowed from X86. Signed-off-by: Huacai Chen <[email protected]> Reviewed-by: Andreas Herrmann <[email protected]> Cc: John Crispin <[email protected]> Cc: Steven J. Hill <[email protected]> Cc: Aurelien Jarno <[email protected]> Cc: [email protected] Cc: Fuxin Zhang <[email protected]> Cc: Zhangjin Wu <[email protected]> Patchwork: https://patchwork.linux-mips.org/patch/7183/ Signed-off-by: Ralf Baechle <[email protected]>
1 parent e5cd534 commit 0f3f506

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

arch/mips/kernel/setup.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,25 @@ static void __init resource_init(void)
729729
}
730730
}
731731

732+
#ifdef CONFIG_SMP
733+
static void __init prefill_possible_map(void)
734+
{
735+
int i, possible = num_possible_cpus();
736+
737+
if (possible > nr_cpu_ids)
738+
possible = nr_cpu_ids;
739+
740+
for (i = 0; i < possible; i++)
741+
set_cpu_possible(i, true);
742+
for (; i < NR_CPUS; i++)
743+
set_cpu_possible(i, false);
744+
745+
nr_cpu_ids = possible;
746+
}
747+
#else
748+
static inline void prefill_possible_map(void) {}
749+
#endif
750+
732751
void __init setup_arch(char **cmdline_p)
733752
{
734753
cpu_probe();
@@ -752,6 +771,7 @@ void __init setup_arch(char **cmdline_p)
752771

753772
resource_init();
754773
plat_smp_setup();
774+
prefill_possible_map();
755775

756776
cpu_cache_init();
757777
}

0 commit comments

Comments
 (0)