[PATCH 1/3] mm: return NUMA_NO_NODE in local_memory_node if zonelists are not setup

Nishanth Aravamudan nacc at linux.vnet.ibm.com
Thu Feb 20 10:17:14 EST 2014


We can call local_memory_node() before the zonelists are setup. In that
case, first_zones_zonelist() will not set zone and the reference to
zone->node will Oops. Catch this case, and, since we presumably running
very early, just return that any node will do.

Signed-off-by: Nishanth Aravamudan <nacc at linux.vnet.ibm.com>
Cc: Andrew Morton <akpm at linux-foundation.org>
Cc: Michal Hocko <mhocko at suse.cz>
Cc: Mel Gorman <mgorman at suse.de>
Cc: linux-mm at kvack.org
Cc: linux-kernel at vger.kernel.org
Cc: Christoph Lameter <cl at linux.com>
Cc: David Rientjes <rientjes at google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim at lge.com>
Cc: Ben Herrenschmidt <benh at kernel.crashing.org>
Cc: Anton Blanchard <anton at samba.org>

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e3758a0..5de4337 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3650,6 +3650,8 @@ int local_memory_node(int node)
 				   gfp_zone(GFP_KERNEL),
 				   NULL,
 				   &zone);
+	if (!zone)
+		return NUMA_NO_NODE;
 	return zone->node;
 }
 #endif



More information about the Linuxppc-dev mailing list