From: Anshuman Khandual khandual@linux.vnet.ibm.com
ascend inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JMLR 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 khandual@linux.vnet.ibm.com Signed-off-by: Lijun Fang fanglijun3@huawei.com Reviewed-by: Weilong Chen chenweilong@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- mm/mempolicy.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 6b6a5f7ce211..41b2f0174f02 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1935,6 +1935,13 @@ static int policy_node(gfp_t gfp, struct mempolicy *policy, int nd) 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; }