[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170130033602.12275-5-khandual@linux.vnet.ibm.com>
Date: Mon, 30 Jan 2017 09:05:45 +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: [RFC V2 04/12] mm: Change mbind(MPOL_BIND) implementation for CDM nodes
CDM nodes need a way of explicit memory allocation mechanism from the user
space. After the previous FALLBACK zonelist rebuilding process changes, the
mbind(MPOL_BIND) based allocation request fails on the CDM node. This is
because allocation requesting local node's FALLBACK zonelist is selected
for further nodemask processing targeted at MPOL_BIND implementation. As
the CDM node's zones are not part of any other regular node's FALLBACK
zonelist, the allocation simply fails without getting any valid zone. The
allocation requesting node is always going to be different than the CDM
node which does not have any CPU. Hence MPOL_MBIND implementation must
choose given CDM node's FALLBACK zonelist instead of the requesting local
node's FALLBACK zonelist. This implements that change.
Signed-off-by: Anshuman Khandual <khandual@...ux.vnet.ibm.com>
---
mm/mempolicy.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 1e7873e..6089c711 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1692,6 +1692,27 @@ static struct zonelist *policy_zonelist(gfp_t gfp, struct mempolicy *policy,
WARN_ON_ONCE(policy->mode == MPOL_BIND && (gfp & __GFP_THISNODE));
}
+#ifdef CONFIG_COHERENT_DEVICE
+ /*
+ * Coherent Device Memory (CDM)
+ *
+ * In case the local requesting node is not part of the nodemask, test
+ * if the first node in the nodemask is CDM, in which case select it.
+ *
+ * XXX: There are multiple ways of doing this. This node check can be
+ * restricted to the first node in the node mask as implemented here or
+ * scan through the entire nodemask to find out any present CDM node on
+ * it or select the first CDM node only if all other nodes in the node
+ * mask are CDM. These are variour approaches possible, the first one
+ * is implemented here.
+ */
+ if (policy->mode == MPOL_BIND) {
+ if (unlikely(!node_isset(nd, policy->v.nodes))) {
+ if (is_cdm_node(first_node(policy->v.nodes)))
+ nd = first_node(policy->v.nodes);
+ }
+ }
+#endif
return node_zonelist(nd, gfp);
}
--
2.9.3
Powered by blists - more mailing lists