Commit c1854e00 authored by Ryan Grimm's avatar Ryan Grimm Committed by Benjamin Herrenschmidt

powerpc: Set nr_cpu_ids early and use it to free PACAs

Without this, "holes" in the CPU numbering can cause us to
free too many PACAs
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent f86d6b9b
...@@ -203,7 +203,7 @@ void __init free_unused_pacas(void) ...@@ -203,7 +203,7 @@ void __init free_unused_pacas(void)
{ {
int new_size; int new_size;
new_size = PAGE_ALIGN(sizeof(struct paca_struct) * num_possible_cpus()); new_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpu_ids);
if (new_size >= paca_size) if (new_size >= paca_size)
return; return;
......
...@@ -509,6 +509,9 @@ void __init smp_setup_cpu_maps(void) ...@@ -509,6 +509,9 @@ void __init smp_setup_cpu_maps(void)
*/ */
cpu_init_thread_core_maps(nthreads); cpu_init_thread_core_maps(nthreads);
/* Now that possible cpus are set, set nr_cpu_ids for later use */
nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1;
free_unused_pacas(); free_unused_pacas();
} }
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment