Skip to content

Commit

Permalink
MIPS: Support hard limit of cpu count (nr_cpu_ids)
Browse files Browse the repository at this point in the history
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 <chenhc@lemote.com>
Reviewed-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: John Crispin <john@phrozen.org>
Cc: Steven J. Hill <Steven.Hill@imgtec.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: linux-mips@linux-mips.org
Cc: Fuxin Zhang <zhangfx@lemote.com>
Cc: Zhangjin Wu <wuzhangjin@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/7183/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Huacai Chen authored and Ralf Baechle committed Jul 30, 2014
1 parent e5cd534 commit 0f3f506
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions arch/mips/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,25 @@ static void __init resource_init(void)
}
}

#ifdef CONFIG_SMP
static void __init prefill_possible_map(void)
{
int i, possible = num_possible_cpus();

if (possible > nr_cpu_ids)
possible = nr_cpu_ids;

for (i = 0; i < possible; i++)
set_cpu_possible(i, true);
for (; i < NR_CPUS; i++)
set_cpu_possible(i, false);

nr_cpu_ids = possible;
}
#else
static inline void prefill_possible_map(void) {}
#endif

void __init setup_arch(char **cmdline_p)
{
cpu_probe();
Expand All @@ -752,6 +771,7 @@ void __init setup_arch(char **cmdline_p)

resource_init();
plat_smp_setup();
prefill_possible_map();

cpu_cache_init();
}
Expand Down

0 comments on commit 0f3f506

Please sign in to comment.