From ea57ddbb2c51f6a8c03206bd362ff10f220dd3fa Mon Sep 17 00:00:00 2001 From: Anshuman Khandual Date: Mon, 13 May 2019 22:39:42 +0800 Subject: [PATCH] mm: Change mbind(MPOL_BIND) implementation for CDM nodes euler inclusion category: feature bugzilla: 11082 CVE: NA ------------------- 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 Signed-off-by: zhong jiang Signed-off-by: Lijun Fang Reviewed-by: zhong jiang Signed-off-by: Yang Yingliang --- mm/mempolicy.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 06c7cd776113..f5e7cacc20cb 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1797,6 +1797,13 @@ static int policy_node(gfp_t gfp, struct mempolicy *policy, WARN_ON_ONCE(policy->mode == MPOL_BIND && (gfp & __GFP_THISNODE)); } + 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); + } + } + return nd; } -- GitLab