From: Vlastimil Babka Date: Tue, 8 Sep 2015 22:03:56 +0000 (-0700) Subject: mm: use numa_mem_id() in alloc_pages_node() X-Git-Tag: v4.3-rc1~40^2~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=82c1fc714763b823169958a98196d9be56c63b30;p=profile%2Fwearable%2Fplatform%2Fkernel%2Flinux-4.9-exynos9110.git mm: use numa_mem_id() in alloc_pages_node() alloc_pages_node() might fail when called with NUMA_NO_NODE and __GFP_THISNODE on a CPU belonging to a memoryless node. To make the local-node fallback more robust and prevent such situations, use numa_mem_id(), which was introduced for similar scenarios in the slab context. Suggested-by: Christoph Lameter Signed-off-by: Vlastimil Babka Acked-by: David Rientjes Acked-by: Mel Gorman Acked-by: Christoph Lameter Cc: Michal Hocko Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 4a12cae2..f92cbd2 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -318,13 +318,14 @@ __alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order) /* * Allocate pages, preferring the node given as nid. When nid == NUMA_NO_NODE, - * prefer the current CPU's node. Otherwise node must be valid and online. + * prefer the current CPU's closest node. Otherwise node must be valid and + * online. */ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order) { if (nid == NUMA_NO_NODE) - nid = numa_node_id(); + nid = numa_mem_id(); return __alloc_pages_node(nid, gfp_mask, order); }