hulk inclusion category: bugfix bugzilla: https://atomgit.com/openeuler/kernel/issues/10127 ---------------------------------------- In alloc_pool_huge_page(), __GFP_MEMALLOC is OR'd into the gfp_mask passed to alloc_fresh_huge_page() when the target node is a no-watermark remote NUMA. For non-gigantic pages this flag allows to allocate below the watermarks, For gigantic pages, allocation is done by alloc_contig_range(), __alloc_contig_verify_gfp_mask() rejects any flags outside the specified masks and __GFP_MEMALLOC is not among them, so it causes the allocation to fail. Since alloc_contig_range() does not consult the watermarks, the flag is unneeded for gigantic pages. Fix this by gating __GFP_MEMALLOC with !hstate_is_gigantic(h). Fixes: 3a1587ef612c ("mm/numa_remote: introduce hugetlb_nowatermark mode for remote node") Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com> --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f597cccb04f5..5b329710c38f 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2328,7 +2328,7 @@ static int alloc_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed, gfp_t gfp = 0; /* Use __GFP_MEMALLOC to make sure all pages can be allocated */ - if (numa_remote_hugetlb_nowatermark(node)) + if (numa_remote_hugetlb_nowatermark(node) && !hstate_is_gigantic(h)) gfp |= __GFP_MEMALLOC; folio = alloc_fresh_hugetlb_folio(h, gfp_mask | gfp, node, -- 2.43.0