Skip to content

Commit c1854e0

Browse files
Ryan Grimmozbenh
authored andcommitted
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: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent f86d6b9 commit c1854e0

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

arch/powerpc/kernel/paca.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void __init free_unused_pacas(void)
203203
{
204204
int new_size;
205205

206-
new_size = PAGE_ALIGN(sizeof(struct paca_struct) * num_possible_cpus());
206+
new_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpu_ids);
207207

208208
if (new_size >= paca_size)
209209
return;

arch/powerpc/kernel/setup-common.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,9 @@ void __init smp_setup_cpu_maps(void)
509509
*/
510510
cpu_init_thread_core_maps(nthreads);
511511

512+
/* Now that possible cpus are set, set nr_cpu_ids for later use */
513+
nr_cpu_ids = find_last_bit(cpumask_bits(cpu_possible_mask),NR_CPUS) + 1;
514+
512515
free_unused_pacas();
513516
}
514517
#endif /* CONFIG_SMP */

0 commit comments

Comments
 (0)