* [PATCH] x86_64: tight online check in setup_per_cpu_areas
@ 2008-03-07 2:25 Yinghai Lu
2008-03-07 8:40 ` Ingo Molnar
0 siblings, 1 reply; 2+ messages in thread
From: Yinghai Lu @ 2008-03-07 2:25 UTC (permalink / raw)
To: Ingo Molnar, Thomas Gleixner, H. Peter Anvin; +Cc: kernel list
[-- Attachment #1: Type: text/plain, Size: 1 bytes --]
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: x86_64_tight_per_cpu.patch --]
[-- Type: text/x-patch; name=x86_64_tight_per_cpu.patch, Size: 1440 bytes --]
[PATCH] x86_64: tight online check in setup_per_cpu_areas
when numa disabled got 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.
so fix it
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Index: linux-2.6/arch/x86/kernel/setup64.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/setup64.c
+++ linux-2.6/arch/x86/kernel/setup64.c
@@ -143,14 +143,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;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86_64: tight online check in setup_per_cpu_areas
2008-03-07 2:25 [PATCH] x86_64: tight online check in setup_per_cpu_areas Yinghai Lu
@ 2008-03-07 8:40 ` Ingo Molnar
0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2008-03-07 8:40 UTC (permalink / raw)
To: Yinghai Lu; +Cc: Thomas Gleixner, H. Peter Anvin, kernel list
* Yinghai Lu <yhlu.kernel@gmail.com> wrote:
> [PATCH] x86_64: tight online check in setup_per_cpu_areas
>
> when numa disabled got 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. so fix it
thanks, applied.
> +#ifndef CONFIG_NEED_MULTIPLE_NODES
> + ptr = alloc_bootmem_pages(size);
> +#else
> + int node = early_cpu_to_node(i);
>
> + if (!node_online(node) || !NODE_DATA(node))
> ptr = alloc_bootmem_pages(size);
> + else
> + ptr = alloc_bootmem_pages_node(NODE_DATA(node), size);
> +#endif
i'm wondering, shouldnt there just be a single facility for this mode of
allocation, instead of this #ifdef and branch maze?
Ingo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-03-07 8:41 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-07 2:25 [PATCH] x86_64: tight online check in setup_per_cpu_areas Yinghai Lu
2008-03-07 8:40 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).