aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/paca.c
diff options
context:
space:
mode:
authorMilton Miller <miltonm@bga.com>2011-05-10 15:28:52 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-05-19 00:30:44 -0400
commit2cd947f1757fb937806535be13caf2ddd813d60b (patch)
tree7c965799f1662e104053ab637666e9efd06d623f /arch/powerpc/kernel/paca.c
parent8657ae28ddd34db0f52b0730a6a25992c0173264 (diff)
powerpc: Use nr_cpu_ids in initial paca allocation
Now that we never set a cpu above nr_cpu_ids possible we can limit our initial paca allocation to nr_cpu_ids. We can then clamp the number of cpus in platforms/iseries/setup.c. Signed-off-by: Milton Miller <miltonm@bga.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/kernel/paca.c')
-rw-r--r--arch/powerpc/kernel/paca.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 102244edecf0..efeb88184182 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -7,7 +7,7 @@
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 */ 8 */
9 9
10#include <linux/threads.h> 10#include <linux/smp.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/memblock.h> 12#include <linux/memblock.h>
13 13
@@ -178,7 +178,7 @@ static int __initdata paca_size;
178 178
179void __init allocate_pacas(void) 179void __init allocate_pacas(void)
180{ 180{
181 int nr_cpus, cpu, limit; 181 int cpu, limit;
182 182
183 /* 183 /*
184 * We can't take SLB misses on the paca, and we want to access them 184 * We can't take SLB misses on the paca, and we want to access them
@@ -190,23 +190,18 @@ void __init allocate_pacas(void)
190 if (firmware_has_feature(FW_FEATURE_ISERIES)) 190 if (firmware_has_feature(FW_FEATURE_ISERIES))
191 limit = min(limit, HvPagesToMap * HVPAGESIZE); 191 limit = min(limit, HvPagesToMap * HVPAGESIZE);
192 192
193 nr_cpus = NR_CPUS; 193 paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpu_ids);
194 /* On iSeries we know we can never have more than 64 cpus */
195 if (firmware_has_feature(FW_FEATURE_ISERIES))
196 nr_cpus = min(64, nr_cpus);
197
198 paca_size = PAGE_ALIGN(sizeof(struct paca_struct) * nr_cpus);
199 194
200 paca = __va(memblock_alloc_base(paca_size, PAGE_SIZE, limit)); 195 paca = __va(memblock_alloc_base(paca_size, PAGE_SIZE, limit));
201 memset(paca, 0, paca_size); 196 memset(paca, 0, paca_size);
202 197
203 printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n", 198 printk(KERN_DEBUG "Allocated %u bytes for %d pacas at %p\n",
204 paca_size, nr_cpus, paca); 199 paca_size, nr_cpu_ids, paca);
205 200
206 allocate_lppacas(nr_cpus, limit); 201 allocate_lppacas(nr_cpu_ids, limit);
207 202
208 /* Can't use for_each_*_cpu, as they aren't functional yet */ 203 /* Can't use for_each_*_cpu, as they aren't functional yet */
209 for (cpu = 0; cpu < nr_cpus; cpu++) 204 for (cpu = 0; cpu < nr_cpu_ids; cpu++)
210 initialise_paca(&paca[cpu], cpu); 205 initialise_paca(&paca[cpu], cpu);
211} 206}
212 207