diff options
author | Vlastimil Babka <vbabka@suse.cz> | 2015-09-08 18:03:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-08 18:35:28 -0400 |
commit | 82c1fc714763b823169958a98196d9be56c63b30 (patch) | |
tree | 270b7eb14f7a6b14fe1afd17b3f41ecabe09f26f /include/linux/gfp.h | |
parent | 0bc35a970c01c50e3bcc4b5a612787346024e5db (diff) |
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 <cl@linux.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Christoph Lameter <cl@linux.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/gfp.h')
-rw-r--r-- | include/linux/gfp.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 4a12cae2fb0c..f92cbd2f4450 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) | |||
318 | 318 | ||
319 | /* | 319 | /* |
320 | * Allocate pages, preferring the node given as nid. When nid == NUMA_NO_NODE, | 320 | * Allocate pages, preferring the node given as nid. When nid == NUMA_NO_NODE, |
321 | * prefer the current CPU's node. Otherwise node must be valid and online. | 321 | * prefer the current CPU's closest node. Otherwise node must be valid and |
322 | * online. | ||
322 | */ | 323 | */ |
323 | static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, | 324 | static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask, |
324 | unsigned int order) | 325 | unsigned int order) |
325 | { | 326 | { |
326 | if (nid == NUMA_NO_NODE) | 327 | if (nid == NUMA_NO_NODE) |
327 | nid = numa_node_id(); | 328 | nid = numa_mem_id(); |
328 | 329 | ||
329 | return __alloc_pages_node(nid, gfp_mask, order); | 330 | return __alloc_pages_node(nid, gfp_mask, order); |
330 | } | 331 | } |