aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-08-19 23:49:45 -0400
committerIngo Molnar <mingo@elte.hu>2008-10-16 10:52:03 -0400
commit1f8ff037a871690c762d267d8a052529d3102fc9 (patch)
tree1b0ce2fdcca21c06fc2b806964670ee0a3ffeab4 /arch
parent1f3fcd4b1adc972d5c6a34cfed98931c46575b49 (diff)
x86: alloc dyn_array all together
so could spare some memory with small alignment in bootmem also tighten the alignment checking, and make print out less debug info. Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/setup_percpu.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 13ba7a83808d..2b7dab699e83 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -140,26 +140,31 @@ static void __init setup_cpu_pda_map(void)
140 */ 140 */
141void __init setup_per_cpu_areas(void) 141void __init setup_per_cpu_areas(void)
142{ 142{
143 ssize_t size, old_size; 143 ssize_t size, old_size, da_size;
144 char *ptr; 144 char *ptr;
145 int cpu; 145 int cpu;
146 unsigned long align = 1;
146 147
147 /* Setup cpu_pda map */ 148 /* Setup cpu_pda map */
148 setup_cpu_pda_map(); 149 setup_cpu_pda_map();
149 150
150 /* Copy section for each CPU (we discard the original) */ 151 /* Copy section for each CPU (we discard the original) */
151 old_size = PERCPU_ENOUGH_ROOM; 152 old_size = PERCPU_ENOUGH_ROOM;
152 size = old_size + per_cpu_dyn_array_size(); 153 da_size = per_cpu_dyn_array_size(&align);
154 align = max_t(unsigned long, PAGE_SIZE, align);
155 size = roundup(old_size + da_size, align);
153 printk(KERN_INFO "PERCPU: Allocating %zd bytes of per cpu data\n", 156 printk(KERN_INFO "PERCPU: Allocating %zd bytes of per cpu data\n",
154 size); 157 size);
155 158
156 for_each_possible_cpu(cpu) { 159 for_each_possible_cpu(cpu) {
157#ifndef CONFIG_NEED_MULTIPLE_NODES 160#ifndef CONFIG_NEED_MULTIPLE_NODES
158 ptr = alloc_bootmem_pages(size); 161 ptr = __alloc_bootmem(size, align,
162 __pa(MAX_DMA_ADDRESS));
159#else 163#else
160 int node = early_cpu_to_node(cpu); 164 int node = early_cpu_to_node(cpu);
161 if (!node_online(node) || !NODE_DATA(node)) { 165 if (!node_online(node) || !NODE_DATA(node)) {
162 ptr = alloc_bootmem_pages(size); 166 ptr = __alloc_bootmem(size, align,
167 __pa(MAX_DMA_ADDRESS));
163 printk(KERN_INFO 168 printk(KERN_INFO
164 "cpu %d has no node %d or node-local memory\n", 169 "cpu %d has no node %d or node-local memory\n",
165 cpu, node); 170 cpu, node);
@@ -168,7 +173,8 @@ void __init setup_per_cpu_areas(void)
168 cpu, __pa(ptr)); 173 cpu, __pa(ptr));
169 } 174 }
170 else { 175 else {
171 ptr = alloc_bootmem_pages_node(NODE_DATA(node), size); 176 ptr = __alloc_bootmem_node(NODE_DATA(node), size, align,
177 __pa(MAX_DMA_ADDRESS));
172 if (ptr) 178 if (ptr)
173 printk(KERN_DEBUG "per cpu data for cpu%d on node%d at %016lx\n", 179 printk(KERN_DEBUG "per cpu data for cpu%d on node%d at %016lx\n",
174 cpu, node, __pa(ptr)); 180 cpu, node, __pa(ptr));