x86, numa, bootmem: Only free bootmem on NUMA failure path
authorYinghai Lu <yinghai@kernel.org>
Sat, 21 Nov 2009 08:23:37 +0000 (00:23 -0800)
committerIngo Molnar <mingo@elte.hu>
Mon, 23 Nov 2009 09:00:48 +0000 (10:00 +0100)
In the NUMA bootmem setup failure path we freed nodedata_phys
incorrectly.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <4B07A739.3030104@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/mm/numa_64.c

index 086f98a66d80a3291fda61afe2933779ec462877..3acd870d316a84533c219638638ed8ed77d428f1 100644 (file)
@@ -239,8 +239,14 @@ setup_node_bootmem(int nodeid, unsigned long start, unsigned long end)
        bootmap = early_node_mem(nodeid, bootmap_start, end,
                                 bootmap_pages<<PAGE_SHIFT, PAGE_SIZE);
        if (bootmap == NULL)  {
-               if (nodedata_phys < start || nodedata_phys >= end)
-                       free_bootmem(nodedata_phys, pgdat_size);
+               if (nodedata_phys < start || nodedata_phys >= end) {
+                       /*
+                        * only need to free it if it is from other node
+                        * bootmem
+                        */
+                       if (nid != nodeid)
+                               free_bootmem(nodedata_phys, pgdat_size);
+               }
                node_data[nodeid] = NULL;
                return;
        }