lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 24 Oct 2016 10:01:53 +0530
From:   Anshuman Khandual <khandual@...ux.vnet.ibm.com>
To:     linux-kernel@...r.kernel.org, linux-mm@...ck.org
Cc:     mhocko@...e.com, js1304@...il.com, vbabka@...e.cz, mgorman@...e.de,
        minchan@...nel.org, akpm@...ux-foundation.org,
        aneesh.kumar@...ux.vnet.ibm.com, bsingharora@...il.com
Subject: [RFC 4/8] mm: Accommodate coherent device memory nodes in MPOL_BIND implementation

This change is part of the isolation requiring coherent device memory nodes
implementation.

Currently MPOL_MBIND interface simply fails on a coherent device memory
node after the zonelist changes introduced earlier. Without __GFP_THISNODE
flag, the first node of the nodemask will not be selected in the case where
the local node (where the application is executing) is not part of the user
provided nodemask for MPOL_MBIND. This will be the case for coherent memory
nodes which are always CPU less. This changes the mbind() system call
implementation so that memory can be allocated from coherent memory node
through MPOL_MBIND interface.

Signed-off-by: Anshuman Khandual <khandual@...ux.vnet.ibm.com>
---
 mm/mempolicy.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 0b859af..cb1ba01 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1694,6 +1694,26 @@ static struct zonelist *policy_zonelist(gfp_t gfp, struct mempolicy *policy,
 		if (unlikely(gfp & __GFP_THISNODE) &&
 				unlikely(!node_isset(nd, policy->v.nodes)))
 			nd = first_node(policy->v.nodes);
+
+#ifdef CONFIG_COHERENT_DEVICE
+		/*
+		 * Coherent device memory
+		 *
+		 * In case the local node is not part of the nodemask, test if
+		 * the first node in the nodemask is a coherent device memory
+		 * node in which case select it.
+		 *
+		 * FIXME: The check will be restricted to the first node of the
+		 * nodemask or scan through the nodemask to select any present
+		 * coherent device memory node on it or select the first one if
+		 * all of the nodes in the nodemask are coherent device memory.
+		 * These are various approaches possible.
+		 */
+		if (unlikely(!node_isset(nd, policy->v.nodes))) {
+			if (isolated_cdm_node(first_node(policy->v.nodes)))
+				nd = first_node(policy->v.nodes);
+		}
+#endif
 		break;
 	default:
 		BUG();
-- 
2.1.0

Powered by blists - more mailing lists