]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm/mempolicy: use policy_node helper with MPOL_PREFERRED_MANY
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Fri, 14 Jan 2022 22:08:14 +0000 (14:08 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 15 Jan 2022 14:30:30 +0000 (16:30 +0200)
Patch series "mm: add new syscall set_mempolicy_home_node", v6.

This patch (of 3):

A followup patch will enable setting a home node with
MPOL_PREFERRED_MANY memory policy.  To facilitate that switch to using
policy_node helper.  There is no functional change in this patch.

Link: https://lkml.kernel.org/r/20211202123810.267175-1-aneesh.kumar@linux.ibm.com
Link: https://lkml.kernel.org/r/20211202123810.267175-2-aneesh.kumar@linux.ibm.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Ben Widawsky <ben.widawsky@intel.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Feng Tang <feng.tang@intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Huang Ying <ying.huang@intel.com>
Cc: <linux-api@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mempolicy.c

index ed7d15acb6a2c87efb7e61208d99d6a0fb801658..de70f119984a22c9c215617da1734bcaa792d54f 100644 (file)
@@ -2062,7 +2062,7 @@ static struct page *alloc_pages_preferred_many(gfp_t gfp, unsigned int order,
        preferred_gfp &= ~(__GFP_DIRECT_RECLAIM | __GFP_NOFAIL);
        page = __alloc_pages(preferred_gfp, order, nid, &pol->nodes);
        if (!page)
-               page = __alloc_pages(gfp, order, numa_node_id(), NULL);
+               page = __alloc_pages(gfp, order, nid, NULL);
 
        return page;
 }
@@ -2104,6 +2104,7 @@ struct page *alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma,
        }
 
        if (pol->mode == MPOL_PREFERRED_MANY) {
+               node = policy_node(gfp, pol, node);
                page = alloc_pages_preferred_many(gfp, order, node, pol);
                mpol_cond_put(pol);
                goto out;
@@ -2187,7 +2188,7 @@ struct page *alloc_pages(gfp_t gfp, unsigned order)
                page = alloc_page_interleave(gfp, order, interleave_nodes(pol));
        else if (pol->mode == MPOL_PREFERRED_MANY)
                page = alloc_pages_preferred_many(gfp, order,
-                               numa_node_id(), pol);
+                                 policy_node(gfp, pol, numa_node_id()), pol);
        else
                page = __alloc_pages(gfp, order,
                                policy_node(gfp, pol, numa_node_id()),