public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] numa, mem-hotplug: Fix stack overflow in numa when seting kernel nodes to unhotpluggable.
@ 2014-01-23  5:49 Tang Chen
  2014-01-23  6:01 ` Dave Jones
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Tang Chen @ 2014-01-23  5:49 UTC (permalink / raw)
  To: davej, tglx, mingo, hpa, akpm, zhangyanfei, guz.fnst; +Cc: x86, linux-kernel

Dave found that the kernel will hang during boot. This is because
the nodemask_t type stack variable numa_kernel_nodes is large enough
to overflow the stack.

This doesn't always happen. According to Dave, this happened once
in about five boots. The backtrace is like the following:

dump_stack
panic
? numa_clear_kernel_node_hotplug
__stack_chk_fail
numa_clear_kernel_node_hotplug
? memblock_search_pfn_nid
? __early_pfn_to_nid
numa_init
x86_numa_init
initmem_init
setup_arch
start_kernel

This patch fix this problem by defining numa_kernel_nodes as a
static global variable in __initdata area.

Reported-by: Dave Jones <davej@redhat.com>
Signed-off-by: Tang Chen <tangchen@cn.fujitsu.com>
Tested-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
---
 arch/x86/mm/numa.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 81b2750..ebefeb7 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -562,10 +562,10 @@ static void __init numa_init_array(void)
 	}
 }
 
+static nodemask_t numa_kernel_nodes __initdata;
 static void __init numa_clear_kernel_node_hotplug(void)
 {
 	int i, nid;
-	nodemask_t numa_kernel_nodes;
 	unsigned long start, end;
 	struct memblock_type *type = &memblock.reserved;
 
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2014-01-28  7:07 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-23  5:49 [PATCH] numa, mem-hotplug: Fix stack overflow in numa when seting kernel nodes to unhotpluggable Tang Chen
2014-01-23  6:01 ` Dave Jones
2014-01-23  6:05 ` Andrew Morton
2014-01-23  6:06 ` David Rientjes
2014-01-23  6:13   ` Dave Jones
2014-01-23  6:15     ` David Rientjes
2014-01-23  6:58       ` Dave Jones
2014-01-23 22:31         ` Dave Jones
2014-01-27  7:29           ` Tang Chen
2014-01-27 14:52             ` Dave Jones
2014-01-23  6:36     ` Tang Chen
2014-01-28  0:32   ` David Rientjes
2014-01-28  1:01     ` Tang Chen
2014-01-28  2:55       ` Dave Jones
2014-01-28  3:14         ` Tang Chen
2014-01-28  3:24         ` Tang Chen
2014-01-28  3:55           ` Dave Jones
2014-01-28  4:47             ` Tang Chen
2014-01-28  4:47               ` Dave Jones
2014-01-28  5:17                 ` Tang Chen
2014-01-28  6:53                   ` Dave Jones
2014-01-28  5:31                 ` Tang Chen
2014-01-28  7:10                   ` Tang Chen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox