Commit 74631a24 authored by Brian Gerst's avatar Brian Gerst Committed by Tejun Heo

x86: always page-align per-cpu area start and size

Impact: cleanup

The way the code is written, align is always PAGE_SIZE.  Simplify
the code by removing the align variable.
Signed-off-by: default avatarBrian Gerst <brgerst@gmail.com>
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent 2f2f52ba
...@@ -69,15 +69,12 @@ EXPORT_SYMBOL(__per_cpu_offset); ...@@ -69,15 +69,12 @@ EXPORT_SYMBOL(__per_cpu_offset);
*/ */
void __init setup_per_cpu_areas(void) void __init setup_per_cpu_areas(void)
{ {
ssize_t size, old_size; ssize_t size;
char *ptr; char *ptr;
int cpu; int cpu;
unsigned long align = 1;
/* Copy section for each CPU (we discard the original) */ /* Copy section for each CPU (we discard the original) */
old_size = PERCPU_ENOUGH_ROOM; size = roundup(PERCPU_ENOUGH_ROOM, PAGE_SIZE);
align = max_t(unsigned long, PAGE_SIZE, align);
size = roundup(old_size, align);
pr_info("NR_CPUS:%d nr_cpumask_bits:%d nr_cpu_ids:%d nr_node_ids:%d\n", pr_info("NR_CPUS:%d nr_cpumask_bits:%d nr_cpu_ids:%d nr_node_ids:%d\n",
NR_CPUS, nr_cpumask_bits, nr_cpu_ids, nr_node_ids); NR_CPUS, nr_cpumask_bits, nr_cpu_ids, nr_node_ids);
...@@ -86,20 +83,17 @@ void __init setup_per_cpu_areas(void) ...@@ -86,20 +83,17 @@ void __init setup_per_cpu_areas(void)
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
#ifndef CONFIG_NEED_MULTIPLE_NODES #ifndef CONFIG_NEED_MULTIPLE_NODES
ptr = __alloc_bootmem(size, align, ptr = alloc_bootmem_pages(size);
__pa(MAX_DMA_ADDRESS));
#else #else
int node = early_cpu_to_node(cpu); int node = early_cpu_to_node(cpu);
if (!node_online(node) || !NODE_DATA(node)) { if (!node_online(node) || !NODE_DATA(node)) {
ptr = __alloc_bootmem(size, align, ptr = alloc_bootmem_pages(size);
__pa(MAX_DMA_ADDRESS));
pr_info("cpu %d has no node %d or node-local memory\n", pr_info("cpu %d has no node %d or node-local memory\n",
cpu, node); cpu, node);
pr_debug("per cpu data for cpu%d at %016lx\n", pr_debug("per cpu data for cpu%d at %016lx\n",
cpu, __pa(ptr)); cpu, __pa(ptr));
} else { } else {
ptr = __alloc_bootmem_node(NODE_DATA(node), size, align, ptr = alloc_bootmem_pages_node(NODE_DATA(node), size);
__pa(MAX_DMA_ADDRESS));
pr_debug("per cpu data for cpu%d on node%d at %016lx\n", pr_debug("per cpu data for cpu%d on node%d at %016lx\n",
cpu, node, __pa(ptr)); cpu, node, __pa(ptr));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment