summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorRyan Grimm <grimm@us.ibm.com>2011-03-31 19:33:02 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2011-06-03 10:33:40 +0900
commitf003fed4410b5da934d4663db9dfb8693dd8dca8 (patch)
treeeab5c9ef594c136b8a9748bbcfc1cff7a459a50c /arch
parent00914170ac616eef890065c518a749ad66899f09 (diff)
powerpc: Set nr_cpu_ids early and use it to free PACAs
commit c1854e00727f50f7ac99e98d26ece04c087ef785 upstream. Without this, "holes" in the CPU numbering can cause us to free too many PACAs Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/paca.c2
-rw-r--r--arch/powerpc/kernel/setup-common.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index f4adf89d7614..10f0aadee95b 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -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;
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 9d4882a46647..21f30cb68077 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -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 */