From: Miaohe Lin Date: Fri, 29 Apr 2022 06:16:02 +0000 (-0700) Subject: mm/memory-failure.c: dissolve truncated hugetlb page X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ef526b17bc3399b8df25d574aa11fc36f89da80a;p=linux.git mm/memory-failure.c: dissolve truncated hugetlb page If me_huge_page meets a truncated but not yet freed hugepage, it won't be dissolved even if we hold the last refcnt. It's because the hugepage has NULL page_mapping while it's not anonymous hugepage too. Thus we lose the last chance to dissolve it into buddy to save healthy subpages. Remove PageAnon check to handle these hugepages too. Link: https://lkml.kernel.org/r/20220414114941.11223-3-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Acked-by: Naoya Horiguchi Cc: David Hildenbrand Cc: Yang Shi Signed-off-by: Andrew Morton --- diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 48815e1af6459..e01a2da803e24 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1040,12 +1040,11 @@ static int me_huge_page(struct page_state *ps, struct page *p) res = MF_FAILED; unlock_page(hpage); /* - * migration entry prevents later access on error anonymous - * hugepage, so we can free and dissolve it into buddy to - * save healthy subpages. + * migration entry prevents later access on error hugepage, + * so we can free and dissolve it into buddy to save healthy + * subpages. */ - if (PageAnon(hpage)) - put_page(hpage); + put_page(hpage); if (__page_handle_poison(p)) { page_ref_inc(p); res = MF_RECOVERED;