The patch titled gfp.h: GFP_THISNODE can go to other nodes if some are unpopulated has been added to the -mm tree. Its filename is gfph-gfp_thisnode-can-go-to-other-nodes-if-some-are-unpopulated.patch *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: gfp.h: GFP_THISNODE can go to other nodes if some are unpopulated From: Nishanth Aravamudan <nacc@xxxxxxxxxx> While testing my sysfs per-node hugepage allocator (http://marc.info/?l=linux-mm&m=117935849517122&w=2), I found that an alloc_pages_node(nid, GFP_THISNODE) request would sometimes return a struct page such that page_to_nid(page) != nid. This was because, on that particular machine, nodes 0 and 1 are populated and nodes 2 and 3 are not. When a page is requested get_page_from_freelist() relies on zonelist->zones[0]->zone_pgdat indicating when THISNODE stops. But, because, say, node 2 has no memory, the first zone_pgdat in the fallback list points to a different node. Add a comment indicating that THISNODE may not return pages on THISNODE if the node is unpopulated. Am working on testing Lee/Anton's patch to add a node_populated_mask and use that in the hugepage allocator path. But I think this may be a problem anywhere THISNODE is used and memory is expected to come from the requested node and nowhere else. Reworked the comment based on feedback from Christoph Lameter. Signed-off-by: Nishanth Aravamudan <nacc@xxxxxxxxxx> Acked-by: Christoph Lameter <clameter@xxxxxxx> Cc: David Rientjes <rientjes@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/gfp.h | 6 ++++++ 1 file changed, 6 insertions(+) diff -puN include/linux/gfp.h~gfph-gfp_thisnode-can-go-to-other-nodes-if-some-are-unpopulated include/linux/gfp.h --- a/include/linux/gfp.h~gfph-gfp_thisnode-can-go-to-other-nodes-if-some-are-unpopulated +++ a/include/linux/gfp.h @@ -67,6 +67,12 @@ struct vm_area_struct; __GFP_HIGHMEM) #ifdef CONFIG_NUMA +/* + * NOTE: GFP_THISNODE allocates from the first available pgdat (== node + * structure) from the zonelist of the requested node. The first pgdat + * may be the pgdat of another node if the requested node has no memory + * on its own. + */ #define GFP_THISNODE (__GFP_THISNODE | __GFP_NOWARN | __GFP_NORETRY) #else #define GFP_THISNODE ((__force gfp_t)0) _ Patches currently in -mm which might be from nacc@xxxxxxxxxx are hugetlb-remove-unnecessary-nid-initialization.patch gfph-gfp_thisnode-can-go-to-other-nodes-if-some-are-unpopulated.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html