summaryrefslogtreecommitdiffstats
path: root/mm/mempolicy.c
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2015-04-14 15:46:52 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-14 16:49:03 -0700
commitb360edb43f8ed50aa7b8c9aae7d7557a1a6e32c8 (patch)
tree67e4b5c902c5a965590047e573bfaa534904efbd /mm/mempolicy.c
parent3cb29d11174f29b76addcba4374884b14f8ea4b1 (diff)
downloadlinux-b360edb43f8ed50aa7b8c9aae7d7557a1a6e32c8.tar.gz
linux-b360edb43f8ed50aa7b8c9aae7d7557a1a6e32c8.tar.bz2
linux-b360edb43f8ed50aa7b8c9aae7d7557a1a6e32c8.zip
mm, mempolicy: migrate_to_node should only migrate to node
migrate_to_node() is intended to migrate a page from one source node to a target node. Today, migrate_to_node() could end up migrating to any node, not only the target node. This is because the page migration allocator, new_node_page() does not pass __GFP_THISNODE to alloc_pages_exact_node(). This causes the target node to be preferred but allows fallback to any other node in order of affinity. Prevent this by allocating with __GFP_THISNODE. If memory is not available, -ENOMEM will be returned as appropriate. Signed-off-by: David Rientjes <rientjes@google.com> Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Mel Gorman <mel@csn.ul.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r--mm/mempolicy.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 4721046a134a..69d05acfa18c 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -945,7 +945,8 @@ static struct page *new_node_page(struct page *page, unsigned long node, int **x
return alloc_huge_page_node(page_hstate(compound_head(page)),
node);
else
- return alloc_pages_exact_node(node, GFP_HIGHUSER_MOVABLE, 0);
+ return alloc_pages_exact_node(node, GFP_HIGHUSER_MOVABLE |
+ __GFP_THISNODE, 0);
}
/*