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

From: Nishanth Aravamudan <[email-masked]>
Date: Wed, 19 Feb 2014 15:32:37 -0800

[ Grr, sorry for not including you originally Andrew, if this ends up
being ok with others, it will probably need to go through your tree. ]

On 19.02.2014 [15:17:14 -0800], Nishanth Aravamudan wrote:
> 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 <[email-masked]>
> Cc: Andrew Morton <[email-masked]>
> Cc: Michal Hocko <[email-masked]>
> Cc: Mel Gorman <[email-masked]>
> Cc: [email-masked]
> Cc: [email-masked]
> Cc: Christoph Lameter <[email-masked]>
> Cc: David Rientjes <[email-masked]>
> Cc: Joonsoo Kim <[email-masked]>
> Cc: Ben Herrenschmidt <[email-masked]>
> Cc: Anton Blanchard <[email-masked]>
> 
> 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