Re: [PATCH v2 1/2] mm/memory-failure: don't unpoison a leaked raw_hwp_unreliable folio

From: Andrew Morton

Date: Thu Nov 19 2026 - 02:11:22 EST


On Thu, 19 Nov 2026 14:39:24 +0800 Miaohe Lin <linmiaohe@xxxxxxxxxx> wrote:

> > + /*
> > + * A hugetlb folio without reliable raw error info is leaked once it
> > + * is freed, and its hugetlb flag may be cleared by then. Check the
> > + * flag in folio->private, which stays set on the leaked folio.
> > + */
> > + if (folio_test_large(folio) &&
> > + folio_test_hugetlb_raw_hwp_unreliable(folio))
>
> It might be better to add a unpoison_pr_info here?

How does this look?

--- a/mm/memory-failure.c~mm-memory-failure-dont-unpoison-a-leaked-raw_hwp_unreliable-folio-fix
+++ a/mm/memory-failure.c
@@ -2818,8 +2818,12 @@ int unpoison_memory(unsigned long pfn)
* flag in folio->private, which stays set on the leaked folio.
*/
if (folio_test_large(folio) &&
- folio_test_hugetlb_raw_hwp_unreliable(folio))
+ folio_test_hugetlb_raw_hwp_unreliable(folio)) {
+ unpoison_pr_info("%#lx: cannot unpoison, poisoned subpages are unknown\n",
+ pfn, &unpoison_rs);
+
goto unlock_mutex;
+ }

ghp = get_hwpoison_page(p, MF_UNPOISON);
if (!ghp) {
_