Skip to content

Commit

Permalink
x86: tight online check in setup_per_cpu_areas
Browse files Browse the repository at this point in the history
when numa disabled I got this compile warning:

arch/x86/kernel/setup64.c: In function setup_per_cpu_areas:
arch/x86/kernel/setup64.c:147: warning: the address of
                      contig_page_data will always evaluate as true

it seems we missed checking if the node is online before we try to refer
NODE_DATA. Fix it.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Yinghai Lu authored and Ingo Molnar committed Mar 21, 2008
1 parent 6721fc0 commit 7d2de13
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions arch/x86/kernel/setup64.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,16 @@ void __init setup_per_cpu_areas(void)
printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n", size);
for_each_cpu_mask (i, cpu_possible_map) {
char *ptr;
#ifndef CONFIG_NEED_MULTIPLE_NODES
ptr = alloc_bootmem_pages(size);
#else
int node = early_cpu_to_node(i);

if (!NODE_DATA(early_cpu_to_node(i))) {
printk("cpu with no node %d, num_online_nodes %d\n",
i, num_online_nodes());
if (!node_online(node) || !NODE_DATA(node))
ptr = alloc_bootmem_pages(size);
} else {
ptr = alloc_bootmem_pages_node(NODE_DATA(early_cpu_to_node(i)), size);
}
else
ptr = alloc_bootmem_pages_node(NODE_DATA(node), size);
#endif
if (!ptr)
panic("Cannot allocate cpu data for CPU %d\n", i);
cpu_pda(i)->data_offset = ptr - __per_cpu_start;
Expand Down

0 comments on commit 7d2de13

Please sign in to comment.