From: Anshuman Khandual khandual@linux.vnet.ibm.com
ascend inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JMLR CVE: NA -------------------
__GFP_THISNODE specifically asks the memory to be allocated from the given node. Not all the requests that end up in __alloc_pages_nodemask() are originated from the process context where cpuset makes more sense. The current condition enforces cpuset limitation on every allocation whether originated from process context or not which prevents __GFP_THISNODE mandated allocations to come from the specified node. In context of the coherent device memory node which is isolated from all cpuset nodemask in the system, it prevents the only way of allocation into it which has been changed with this patch.
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/page_alloc.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 9ffa2badb706..4bfb52cb677f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4896,7 +4896,11 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, ac->nodemask = nodemask; ac->migratetype = gfp_migratetype(gfp_mask);
+#ifdef CONFIG_COHERENT_DEVICE + if (cpusets_enabled() && !(*alloc_gfp & __GFP_THISNODE)) { +#else if (cpusets_enabled()) { +#endif *alloc_gfp |= __GFP_HARDWALL; /* * When we are in the interrupt context, it is irrelevant