From 17806eddb359c524300ac1e9f153ea8a00fcac1b Mon Sep 17 00:00:00 2001 From: yangge Date: Mon, 30 Oct 2023 01:56:07 -0400 Subject: [PATCH] anolis: mm: hugetlb: Remove flag __GFP_THISNODE to avoid failures ANBZ: #8069 In current code, allocate new page with flag __GFP_THISNODE, meaning we do not fallback to other node's zones. If current node has no free memory, but other nodes has enough memory to satisfy allocation, it's unreasonable to fail. Allocating memory with __GFP_THISNODE in alloc_and_dissolve_huge_page will fail if current node has no free memory, which will lead to hugetlb page migration fail at last. So we remove flag __GFP_THISNODE to avoid these failures. Signed-off-by: yangge Signed-off-by: Xin Jiang --- mm/hugetlb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 93c54f8e8007..cb2a6f13c1ab 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2399,7 +2399,7 @@ static void restore_reserve_on_error(struct hstate *h, static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, struct list_head *list) { - gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE; + gfp_t gfp_mask = htlb_alloc_mask(h); int nid = page_to_nid(old_page); struct page *new_page; int ret = 0; @@ -2457,7 +2457,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, * Reference count trick is needed because allocator gives us * referenced page but the pool requires pages with 0 refcount. */ - __prep_account_new_huge_page(h, nid); + __prep_account_new_huge_page(h, page_to_nid(new_page)); page_ref_dec(new_page); enqueue_huge_page(h, new_page); -- Gitee