[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200630212517.308045-10-ben.widawsky@intel.com>
Date: Tue, 30 Jun 2020 14:25:14 -0700
From: Ben Widawsky <ben.widawsky@...el.com>
To: linux-mm <linux-mm@...ck.org>, linux-kernel@...r.kernel.org
Cc: Michal Hocko <mhocko@...nel.org>,
Dave Hansen <dave.hansen@...el.com>,
Ben Widawsky <ben.widawsky@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>
Subject: [PATCH 09/12] mm/mempolicy: Thread allocation for many preferred
In order to support MPOL_PREFERRED_MANY as the mode used by
set_mempolicy(2), alloc_pages_current() needs to support it. This patch
does that by using the new helper function to allocate properly based on
policy.
All the actual machinery to make this work was part of
("mm/mempolicy: Create a page allocator for policy")
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Michal Hocko <mhocko@...nel.org>
Cc: Vlastimil Babka <vbabka@...e.cz>
Signed-off-by: Ben Widawsky <ben.widawsky@...el.com>
---
mm/mempolicy.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 1009cf90ad37..5fb70e6599a6 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2365,7 +2365,7 @@ EXPORT_SYMBOL(alloc_pages_vma);
struct page *alloc_pages_current(gfp_t gfp, unsigned order)
{
struct mempolicy *pol = &default_policy;
- struct page *page;
+ int nid = NUMA_NO_NODE;
if (!in_interrupt() && !(gfp & __GFP_THISNODE))
pol = get_task_policy(current);
@@ -2375,13 +2375,10 @@ struct page *alloc_pages_current(gfp_t gfp, unsigned order)
* nor system default_policy
*/
if (pol->mode == MPOL_INTERLEAVE)
- page = alloc_pages_policy(pol, gfp, order, interleave_nodes(pol));
- else
- page = __alloc_pages_nodemask(gfp, order,
- policy_node(gfp, pol, numa_node_id()),
- policy_nodemask(gfp, pol));
+ nid = interleave_nodes(pol);
+
+ return alloc_pages_policy(pol, gfp, order, nid);
- return page;
}
EXPORT_SYMBOL(alloc_pages_current);
--
2.27.0
Powered by blists - more mailing lists