aboutsummaryrefslogtreecommitdiff
path: root/arch/sparc/kernel/smp_64.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-04-01 01:47:10 -0700
committerDavid S. Miller <davem@davemloft.net>2009-06-16 04:56:11 -0700
commit5a5488d3bb9a23d9884572e5d85dfeefe8749d3d (patch)
treeafa8db75cdf771257cd5541ed80a606df60f9cf8 /arch/sparc/kernel/smp_64.c
parent19f0fa3fb3499d8c5fb861933959f546d05fc202 (diff)
sparc64: Store per-cpu offset in trap_block[]
Surprisingly this actually makes LOAD_PER_CPU_BASE() a little more efficient. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/smp_64.c')
-rw-r--r--arch/sparc/kernel/smp_64.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 4226d0ebaea..b20f253857b 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -1371,23 +1371,17 @@ void smp_send_stop(void)
{
}
-unsigned long __per_cpu_base __read_mostly;
-unsigned long __per_cpu_shift __read_mostly;
-
-EXPORT_SYMBOL(__per_cpu_base);
-EXPORT_SYMBOL(__per_cpu_shift);
-
void __init real_setup_per_cpu_areas(void)
{
- unsigned long paddr, goal, size, i;
+ unsigned long base, shift, paddr, goal, size, i;
char *ptr;
/* Copy section for each CPU (we discard the original) */
goal = PERCPU_ENOUGH_ROOM;
- __per_cpu_shift = PAGE_SHIFT;
+ shift = PAGE_SHIFT;
for (size = PAGE_SIZE; size < goal; size <<= 1UL)
- __per_cpu_shift++;
+ shift++;
paddr = lmb_alloc(size * NR_CPUS, PAGE_SIZE);
if (!paddr) {
@@ -1396,10 +1390,12 @@ void __init real_setup_per_cpu_areas(void)
}
ptr = __va(paddr);
- __per_cpu_base = ptr - __per_cpu_start;
+ base = ptr - __per_cpu_start;
- for (i = 0; i < NR_CPUS; i++, ptr += size)
+ for (i = 0; i < NR_CPUS; i++, ptr += size) {
+ __per_cpu_offset(i) = base + (i * size);
memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
+ }
/* Setup %g5 for the boot cpu. */
__local_per_cpu_offset = __per_cpu_offset(smp_processor_id());