From: Christoph Lameter Add the node in order to optimize zone_to_nid. Signed-off-by: Christoph Lameter Acked-by: Paul Jackson Signed-off-by: Andrew Morton --- include/linux/mm.h | 2 +- include/linux/mmzone.h | 1 + mm/page_alloc.c | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff -puN include/linux/mm.h~add-node-to-zone-for-the-numa-case include/linux/mm.h --- a/include/linux/mm.h~add-node-to-zone-for-the-numa-case +++ a/include/linux/mm.h @@ -446,7 +446,7 @@ static inline struct zone *page_zone(str static inline unsigned long zone_to_nid(struct zone *zone) { - return zone->zone_pgdat->node_id; + return zone->node; } static inline unsigned long page_to_nid(struct page *page) diff -puN include/linux/mmzone.h~add-node-to-zone-for-the-numa-case include/linux/mmzone.h --- a/include/linux/mmzone.h~add-node-to-zone-for-the-numa-case +++ a/include/linux/mmzone.h @@ -168,6 +168,7 @@ struct zone { unsigned long lowmem_reserve[MAX_NR_ZONES]; #ifdef CONFIG_NUMA + int node; /* * zone reclaim becomes active if more unmapped pages exist. */ diff -puN mm/page_alloc.c~add-node-to-zone-for-the-numa-case mm/page_alloc.c --- a/mm/page_alloc.c~add-node-to-zone-for-the-numa-case +++ a/mm/page_alloc.c @@ -2395,6 +2395,7 @@ static void __meminit free_area_init_cor zone->spanned_pages = size; zone->present_pages = realsize; #ifdef CONFIG_NUMA + zone->node = nid; zone->min_unmapped_pages = (realsize*sysctl_min_unmapped_ratio) / 100; zone->min_slab_pages = (realsize * sysctl_min_slab_ratio) / 100; _