diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2007-05-02 13:27:12 -0400 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2007-05-02 13:27:12 -0400 |
commit | b6e3590f8145c77b8fcef3247e2412335221412f (patch) | |
tree | 47fb1a28e41fd9f4e1aef45b5482b69b8d7c154e /arch | |
parent | de90c5ce832b1218042316260ff9268b00fdcba3 (diff) |
[PATCH] x86: Allow percpu variables to be page-aligned
Let's allow page-alignment in general for per-cpu data (wanted by Xen, and
Ingo suggested KVM as well).
Because larger alignments can use more room, we increase the max per-cpu
memory to 64k rather than 32k: it's getting a little tight.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/arm/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/cris/arch-v32/vmlinux.lds.S | 1 | ||||
-rw-r--r-- | arch/frv/kernel/vmlinux.lds.S | 1 | ||||
-rw-r--r-- | arch/i386/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/m32r/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/mips/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/parisc/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/vmlinux.lds.S | 6 | ||||
-rw-r--r-- | arch/ppc/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/s390/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/sh/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/sh64/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/sparc64/kernel/smp.c | 6 | ||||
-rw-r--r-- | arch/x86_64/kernel/setup64.c | 4 | ||||
-rw-r--r-- | arch/x86_64/kernel/vmlinux.lds.S | 2 | ||||
-rw-r--r-- | arch/xtensa/kernel/vmlinux.lds.S | 2 |
19 files changed, 23 insertions, 25 deletions
diff --git a/arch/alpha/kernel/vmlinux.lds.S b/arch/alpha/kernel/vmlinux.lds.S index 4cc44bd33d33..cf1e6fc6c686 100644 --- a/arch/alpha/kernel/vmlinux.lds.S +++ b/arch/alpha/kernel/vmlinux.lds.S | |||
@@ -69,7 +69,7 @@ SECTIONS | |||
69 | . = ALIGN(8); | 69 | . = ALIGN(8); |
70 | SECURITY_INIT | 70 | SECURITY_INIT |
71 | 71 | ||
72 | . = ALIGN(64); | 72 | . = ALIGN(8192); |
73 | __per_cpu_start = .; | 73 | __per_cpu_start = .; |
74 | .data.percpu : { *(.data.percpu) } | 74 | .data.percpu : { *(.data.percpu) } |
75 | __per_cpu_end = .; | 75 | __per_cpu_end = .; |
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index ddbdad48f5b2..d1a6a597ed9a 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S | |||
@@ -59,7 +59,7 @@ SECTIONS | |||
59 | usr/built-in.o(.init.ramfs) | 59 | usr/built-in.o(.init.ramfs) |
60 | __initramfs_end = .; | 60 | __initramfs_end = .; |
61 | #endif | 61 | #endif |
62 | . = ALIGN(64); | 62 | . = ALIGN(4096); |
63 | __per_cpu_start = .; | 63 | __per_cpu_start = .; |
64 | *(.data.percpu) | 64 | *(.data.percpu) |
65 | __per_cpu_end = .; | 65 | __per_cpu_end = .; |
diff --git a/arch/cris/arch-v32/vmlinux.lds.S b/arch/cris/arch-v32/vmlinux.lds.S index e124fcd766d5..dfa25e1542b9 100644 --- a/arch/cris/arch-v32/vmlinux.lds.S +++ b/arch/cris/arch-v32/vmlinux.lds.S | |||
@@ -91,6 +91,7 @@ SECTIONS | |||
91 | } | 91 | } |
92 | SECURITY_INIT | 92 | SECURITY_INIT |
93 | 93 | ||
94 | . = ALIGN (8192); | ||
94 | __per_cpu_start = .; | 95 | __per_cpu_start = .; |
95 | .data.percpu : { *(.data.percpu) } | 96 | .data.percpu : { *(.data.percpu) } |
96 | __per_cpu_end = .; | 97 | __per_cpu_end = .; |
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S index 97910e016825..28eae9735ad6 100644 --- a/arch/frv/kernel/vmlinux.lds.S +++ b/arch/frv/kernel/vmlinux.lds.S | |||
@@ -57,6 +57,7 @@ SECTIONS | |||
57 | __alt_instructions_end = .; | 57 | __alt_instructions_end = .; |
58 | .altinstr_replacement : { *(.altinstr_replacement) } | 58 | .altinstr_replacement : { *(.altinstr_replacement) } |
59 | 59 | ||
60 | . = ALIGN(4096); | ||
60 | __per_cpu_start = .; | 61 | __per_cpu_start = .; |
61 | .data.percpu : { *(.data.percpu) } | 62 | .data.percpu : { *(.data.percpu) } |
62 | __per_cpu_end = .; | 63 | __per_cpu_end = .; |
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S index f4ec72231835..97fe6eac47c9 100644 --- a/arch/i386/kernel/vmlinux.lds.S +++ b/arch/i386/kernel/vmlinux.lds.S | |||
@@ -194,7 +194,7 @@ SECTIONS | |||
194 | __initramfs_end = .; | 194 | __initramfs_end = .; |
195 | } | 195 | } |
196 | #endif | 196 | #endif |
197 | . = ALIGN(L1_CACHE_BYTES); | 197 | . = ALIGN(4096); |
198 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { | 198 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { |
199 | __per_cpu_start = .; | 199 | __per_cpu_start = .; |
200 | *(.data.percpu) | 200 | *(.data.percpu) |
diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S index 439cc257cd1d..6c73bca3f478 100644 --- a/arch/m32r/kernel/vmlinux.lds.S +++ b/arch/m32r/kernel/vmlinux.lds.S | |||
@@ -110,7 +110,7 @@ SECTIONS | |||
110 | __initramfs_end = .; | 110 | __initramfs_end = .; |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | . = ALIGN(32); | 113 | . = ALIGN(4096); |
114 | __per_cpu_start = .; | 114 | __per_cpu_start = .; |
115 | .data.percpu : { *(.data.percpu) } | 115 | .data.percpu : { *(.data.percpu) } |
116 | __per_cpu_end = .; | 116 | __per_cpu_end = .; |
diff --git a/arch/mips/kernel/vmlinux.lds.S b/arch/mips/kernel/vmlinux.lds.S index c76b793310c2..043f637e3d10 100644 --- a/arch/mips/kernel/vmlinux.lds.S +++ b/arch/mips/kernel/vmlinux.lds.S | |||
@@ -119,7 +119,7 @@ SECTIONS | |||
119 | .init.ramfs : { *(.init.ramfs) } | 119 | .init.ramfs : { *(.init.ramfs) } |
120 | __initramfs_end = .; | 120 | __initramfs_end = .; |
121 | #endif | 121 | #endif |
122 | . = ALIGN(32); | 122 | . = ALIGN(_PAGE_SIZE); |
123 | __per_cpu_start = .; | 123 | __per_cpu_start = .; |
124 | .data.percpu : { *(.data.percpu) } | 124 | .data.percpu : { *(.data.percpu) } |
125 | __per_cpu_end = .; | 125 | __per_cpu_end = .; |
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S index 2a8253358c6c..c74585990598 100644 --- a/arch/parisc/kernel/vmlinux.lds.S +++ b/arch/parisc/kernel/vmlinux.lds.S | |||
@@ -181,7 +181,7 @@ SECTIONS | |||
181 | .init.ramfs : { *(.init.ramfs) } | 181 | .init.ramfs : { *(.init.ramfs) } |
182 | __initramfs_end = .; | 182 | __initramfs_end = .; |
183 | #endif | 183 | #endif |
184 | . = ALIGN(32); | 184 | . = ALIGN(ASM_PAGE_SIZE); |
185 | __per_cpu_start = .; | 185 | __per_cpu_start = .; |
186 | .data.percpu : { *(.data.percpu) } | 186 | .data.percpu : { *(.data.percpu) } |
187 | __per_cpu_end = .; | 187 | __per_cpu_end = .; |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index 22083ce3cc30..6018178708a5 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -582,14 +582,14 @@ void __init setup_per_cpu_areas(void) | |||
582 | char *ptr; | 582 | char *ptr; |
583 | 583 | ||
584 | /* Copy section for each CPU (we discard the original) */ | 584 | /* Copy section for each CPU (we discard the original) */ |
585 | size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES); | 585 | size = ALIGN(__per_cpu_end - __per_cpu_start, PAGE_SIZE); |
586 | #ifdef CONFIG_MODULES | 586 | #ifdef CONFIG_MODULES |
587 | if (size < PERCPU_ENOUGH_ROOM) | 587 | if (size < PERCPU_ENOUGH_ROOM) |
588 | size = PERCPU_ENOUGH_ROOM; | 588 | size = PERCPU_ENOUGH_ROOM; |
589 | #endif | 589 | #endif |
590 | 590 | ||
591 | for_each_possible_cpu(i) { | 591 | for_each_possible_cpu(i) { |
592 | ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size); | 592 | ptr = alloc_bootmem_pages_node(NODE_DATA(cpu_to_node(i)), size); |
593 | if (!ptr) | 593 | if (!ptr) |
594 | panic("Cannot allocate cpu data for CPU %d\n", i); | 594 | panic("Cannot allocate cpu data for CPU %d\n", i); |
595 | 595 | ||
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 7eefeb4a30e7..132067313147 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S | |||
@@ -139,11 +139,7 @@ SECTIONS | |||
139 | __initramfs_end = .; | 139 | __initramfs_end = .; |
140 | } | 140 | } |
141 | #endif | 141 | #endif |
142 | #ifdef CONFIG_PPC32 | 142 | . = ALIGN(PAGE_SIZE); |
143 | . = ALIGN(32); | ||
144 | #else | ||
145 | . = ALIGN(128); | ||
146 | #endif | ||
147 | .data.percpu : { | 143 | .data.percpu : { |
148 | __per_cpu_start = .; | 144 | __per_cpu_start = .; |
149 | *(.data.percpu) | 145 | *(.data.percpu) |
diff --git a/arch/ppc/kernel/vmlinux.lds.S b/arch/ppc/kernel/vmlinux.lds.S index a0625562a44b..44cd128fb719 100644 --- a/arch/ppc/kernel/vmlinux.lds.S +++ b/arch/ppc/kernel/vmlinux.lds.S | |||
@@ -130,7 +130,7 @@ SECTIONS | |||
130 | __ftr_fixup : { *(__ftr_fixup) } | 130 | __ftr_fixup : { *(__ftr_fixup) } |
131 | __stop___ftr_fixup = .; | 131 | __stop___ftr_fixup = .; |
132 | 132 | ||
133 | . = ALIGN(32); | 133 | . = ALIGN(4096); |
134 | __per_cpu_start = .; | 134 | __per_cpu_start = .; |
135 | .data.percpu : { *(.data.percpu) } | 135 | .data.percpu : { *(.data.percpu) } |
136 | __per_cpu_end = .; | 136 | __per_cpu_end = .; |
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 418f6426a949..e9d3432aba60 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S | |||
@@ -107,7 +107,7 @@ SECTIONS | |||
107 | . = ALIGN(2); | 107 | . = ALIGN(2); |
108 | __initramfs_end = .; | 108 | __initramfs_end = .; |
109 | #endif | 109 | #endif |
110 | . = ALIGN(256); | 110 | . = ALIGN(4096); |
111 | __per_cpu_start = .; | 111 | __per_cpu_start = .; |
112 | .data.percpu : { *(.data.percpu) } | 112 | .data.percpu : { *(.data.percpu) } |
113 | __per_cpu_end = .; | 113 | __per_cpu_end = .; |
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S index 78a6c09875b2..2f606d0ce1f6 100644 --- a/arch/sh/kernel/vmlinux.lds.S +++ b/arch/sh/kernel/vmlinux.lds.S | |||
@@ -54,7 +54,7 @@ SECTIONS | |||
54 | . = ALIGN(PAGE_SIZE); | 54 | . = ALIGN(PAGE_SIZE); |
55 | .data.page_aligned : { *(.data.page_aligned) } | 55 | .data.page_aligned : { *(.data.page_aligned) } |
56 | 56 | ||
57 | . = ALIGN(L1_CACHE_BYTES); | 57 | . = ALIGN(PAGE_SIZE); |
58 | __per_cpu_start = .; | 58 | __per_cpu_start = .; |
59 | .data.percpu : { *(.data.percpu) } | 59 | .data.percpu : { *(.data.percpu) } |
60 | __per_cpu_end = .; | 60 | __per_cpu_end = .; |
diff --git a/arch/sh64/kernel/vmlinux.lds.S b/arch/sh64/kernel/vmlinux.lds.S index a59c5e998131..4f9616f39830 100644 --- a/arch/sh64/kernel/vmlinux.lds.S +++ b/arch/sh64/kernel/vmlinux.lds.S | |||
@@ -85,7 +85,7 @@ SECTIONS | |||
85 | . = ALIGN(PAGE_SIZE); | 85 | . = ALIGN(PAGE_SIZE); |
86 | .data.page_aligned : C_PHYS(.data.page_aligned) { *(.data.page_aligned) } | 86 | .data.page_aligned : C_PHYS(.data.page_aligned) { *(.data.page_aligned) } |
87 | 87 | ||
88 | . = ALIGN(L1_CACHE_BYTES); | 88 | . = ALIGN(PAGE_SIZE); |
89 | __per_cpu_start = .; | 89 | __per_cpu_start = .; |
90 | .data.percpu : C_PHYS(.data.percpu) { *(.data.percpu) } | 90 | .data.percpu : C_PHYS(.data.percpu) { *(.data.percpu) } |
91 | __per_cpu_end = . ; | 91 | __per_cpu_end = . ; |
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S index e5c24e0521de..f0bb6e60e620 100644 --- a/arch/sparc/kernel/vmlinux.lds.S +++ b/arch/sparc/kernel/vmlinux.lds.S | |||
@@ -65,7 +65,7 @@ SECTIONS | |||
65 | __initramfs_end = .; | 65 | __initramfs_end = .; |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | . = ALIGN(32); | 68 | . = ALIGN(4096); |
69 | __per_cpu_start = .; | 69 | __per_cpu_start = .; |
70 | .data.percpu : { *(.data.percpu) } | 70 | .data.percpu : { *(.data.percpu) } |
71 | __per_cpu_end = .; | 71 | __per_cpu_end = .; |
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index d4f0a70f4845..1fac215252e4 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c | |||
@@ -1343,11 +1343,11 @@ void __init setup_per_cpu_areas(void) | |||
1343 | /* Copy section for each CPU (we discard the original) */ | 1343 | /* Copy section for each CPU (we discard the original) */ |
1344 | goal = PERCPU_ENOUGH_ROOM; | 1344 | goal = PERCPU_ENOUGH_ROOM; |
1345 | 1345 | ||
1346 | __per_cpu_shift = 0; | 1346 | __per_cpu_shift = PAGE_SHIFT; |
1347 | for (size = 1UL; size < goal; size <<= 1UL) | 1347 | for (size = PAGE_SIZE; size < goal; size <<= 1UL) |
1348 | __per_cpu_shift++; | 1348 | __per_cpu_shift++; |
1349 | 1349 | ||
1350 | ptr = alloc_bootmem(size * NR_CPUS); | 1350 | ptr = alloc_bootmem_pages(size * NR_CPUS); |
1351 | 1351 | ||
1352 | __per_cpu_base = ptr - __per_cpu_start; | 1352 | __per_cpu_base = ptr - __per_cpu_start; |
1353 | 1353 | ||
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c index 53064a9a365f..64379a80d763 100644 --- a/arch/x86_64/kernel/setup64.c +++ b/arch/x86_64/kernel/setup64.c | |||
@@ -103,9 +103,9 @@ void __init setup_per_cpu_areas(void) | |||
103 | if (!NODE_DATA(cpu_to_node(i))) { | 103 | if (!NODE_DATA(cpu_to_node(i))) { |
104 | printk("cpu with no node %d, num_online_nodes %d\n", | 104 | printk("cpu with no node %d, num_online_nodes %d\n", |
105 | i, num_online_nodes()); | 105 | i, num_online_nodes()); |
106 | ptr = alloc_bootmem(size); | 106 | ptr = alloc_bootmem_pages(size); |
107 | } else { | 107 | } else { |
108 | ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size); | 108 | ptr = alloc_bootmem_pages_node(NODE_DATA(cpu_to_node(i)), size); |
109 | } | 109 | } |
110 | if (!ptr) | 110 | if (!ptr) |
111 | panic("Cannot allocate cpu data for CPU %d\n", i); | 111 | panic("Cannot allocate cpu data for CPU %d\n", i); |
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S index 3bdeb88d28f4..7ef0b8820cd2 100644 --- a/arch/x86_64/kernel/vmlinux.lds.S +++ b/arch/x86_64/kernel/vmlinux.lds.S | |||
@@ -195,7 +195,7 @@ SECTIONS | |||
195 | __initramfs_end = .; | 195 | __initramfs_end = .; |
196 | #endif | 196 | #endif |
197 | 197 | ||
198 | . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); | 198 | . = ALIGN(4096); |
199 | __per_cpu_start = .; | 199 | __per_cpu_start = .; |
200 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) } | 200 | .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { *(.data.percpu) } |
201 | __per_cpu_end = .; | 201 | __per_cpu_end = .; |
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S index ab6370054cee..4fbd66a52a88 100644 --- a/arch/xtensa/kernel/vmlinux.lds.S +++ b/arch/xtensa/kernel/vmlinux.lds.S | |||
@@ -198,7 +198,7 @@ SECTIONS | |||
198 | __ftr_fixup : { *(__ftr_fixup) } | 198 | __ftr_fixup : { *(__ftr_fixup) } |
199 | __stop___ftr_fixup = .; | 199 | __stop___ftr_fixup = .; |
200 | 200 | ||
201 | . = ALIGN(32); | 201 | . = ALIGN(4096); |
202 | __per_cpu_start = .; | 202 | __per_cpu_start = .; |
203 | .data.percpu : { *(.data.percpu) } | 203 | .data.percpu : { *(.data.percpu) } |
204 | __per_cpu_end = .; | 204 | __per_cpu_end = .; |