[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170215120726.9011-5-khandual@linux.vnet.ibm.com>
Date: Wed, 15 Feb 2017 17:37:26 +0530
From: Anshuman Khandual <khandual@...ux.vnet.ibm.com>
To: linux-kernel@...r.kernel.org, linux-mm@...ck.org
Cc: mhocko@...e.com, vbabka@...e.cz, mgorman@...e.de,
minchan@...nel.org, aneesh.kumar@...ux.vnet.ibm.com,
bsingharora@...il.com, srikar@...ux.vnet.ibm.com,
haren@...ux.vnet.ibm.com, jglisse@...hat.com,
dave.hansen@...el.com, dan.j.williams@...el.com
Subject: [PATCH V3 4/4] mm: Enable Buddy allocation isolation for CDM nodes
This implements allocation isolation for CDM nodes in buddy allocator by
discarding CDM memory zones all the time except in the cases where the gfp
flag has got __GFP_THISNODE or the nodemask contains CDM nodes in cases
where it is non NULL (explicit allocation request in the kernel or user
process MPOL_BIND policy based requests).
Signed-off-by: Anshuman Khandual <khandual@...ux.vnet.ibm.com>
---
mm/page_alloc.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index afbd24d..40c942c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -64,6 +64,7 @@
#include <linux/page_owner.h>
#include <linux/kthread.h>
#include <linux/memcontrol.h>
+#include <linux/node.h>
#include <asm/sections.h>
#include <asm/tlbflush.h>
@@ -2898,6 +2899,10 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
struct zoneref *z = ac->preferred_zoneref;
struct zone *zone;
struct pglist_data *last_pgdat_dirty_limit = NULL;
+ bool cpuset_fallback = false;
+
+ if (ac->nodemask != orig_mask)
+ cpuset_fallback = true;
/*
* Scan zonelist, looking for a zone with enough free.
@@ -2908,6 +2913,24 @@ get_page_from_freelist(gfp_t gfp_mask, unsigned int order, int alloc_flags,
struct page *page;
unsigned long mark;
+ /*
+ * CDM nodes get skipped if the requested gfp flag
+ * does not have __GFP_THISNODE set or the nodemask
+ * does not have any CDM nodes in case the nodemask
+ * is non NULL (explicit allocation requests from
+ * kernel or user process MPOL_BIND policy which has
+ * CDM nodes).
+ */
+ if (is_cdm_node(zone->zone_pgdat->node_id)) {
+ if (!(gfp_mask & __GFP_THISNODE)) {
+ if (cpuset_fallback)
+ continue;
+
+ if (!ac->nodemask)
+ continue;
+ }
+ }
+
if (cpusets_enabled() &&
(alloc_flags & ALLOC_CPUSET) &&
!__cpuset_zone_allowed(zone, gfp_mask))
--
2.9.3
Powered by blists - more mailing lists