Skip to content

Commit

Permalink
powerpc: Set nr_cpu_ids early and use it to free PACAs
Browse files Browse the repository at this point in the history
Without this, "holes" in the CPU numbering can cause us to
free too many PACAs

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Ryan Grimm authored and Benjamin Herrenschmidt committed Apr 5, 2011
1 parent f86d6b9 commit c1854e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/paca.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void __init free_unused_pacas(void)
{
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)
return;
Expand Down
3 changes: 3 additions & 0 deletions arch/powerpc/kernel/setup-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,9 @@ void __init smp_setup_cpu_maps(void)
*/
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();
}
#endif /* CONFIG_SMP */
Expand Down

0 comments on commit c1854e0

Please sign in to comment.