[Devel] [PATCH RHEL7 COMMIT] ms/mm, mempolicy: migrate_to_node should only migrate to node

Konstantin Khorenko khorenko at virtuozzo.com
Thu Oct 18 12:33:51 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-862.14.4.vz7.72.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.14.4.vz7.72.11
------>
commit f60665481d083df340c4d332d4074d7d84a6d715
Author: David Rientjes <rientjes at google.com>
Date:   Tue Apr 14 15:46:52 2015 -0700

    ms/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 at google.com>
    Reviewed-by: Naoya Horiguchi <n-horiguchi at ah.jp.nec.com>
    Cc: Mel Gorman <mel at csn.ul.ie>
    Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
    
    https://jira.sw.ru/browse/PSBM-89512
    https://access.redhat.com/solutions/3538691
    
    (cherry picked from commit b360edb43f8ed50aa7b8c9aae7d7557a1a6e32c8)
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 mm/mempolicy.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 400190f8ad67..99834097dca0 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1024,7 +1024,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);
 }
 
 /*



More information about the Devel mailing list