From 148b50b769a76d95d98d62f3f159c286ec9083f8 Mon Sep 17 00:00:00 2001 From: Anshuman Khandual Date: Mon, 13 May 2019 22:39:41 +0800 Subject: [PATCH] mm: Ignore cpuset enforcement when allocation flag has __GFP_THISNODE euler inclusion category: feature bugzilla: 11082 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 Signed-off-by: zhong jiang Signed-off-by: Lijun Fang Reviewed-by: zhong jiang Signed-off-by: Yang Yingliang --- mm/page_alloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index cbfe0af6b303..d95e47a388b1 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4335,7 +4335,11 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order, ac->nodemask = nodemask; ac->migratetype = gfpflags_to_migratetype(gfp_mask); +#ifdef CONFIG_COHERENT_DEVICE + if (cpusets_enabled() && !(*alloc_mask & __GFP_THISNODE)) { +#else if (cpusets_enabled()) { +#endif *alloc_mask |= __GFP_HARDWALL; if (!ac->nodemask) ac->nodemask = &cpuset_current_mems_allowed; -- GitLab