Re: [PATCH v2 0/2] mm/hugetlb: clear the hugetlb flag before leaking a hwpoisoned folio
From: Andrew Morton
Date: Thu Nov 19 2026 - 02:06:46 EST
On Tue, 03 Nov 2026 16:00:48 -0500 Mani Tofigh <mt4022@xxxxxxxxxxxx> wrote:
> If memory_failure() can't save the raw error page of a hugetlb folio,
> the folio is marked raw_hwp_unreliable and leaked once it's freed. With
> hugetlb_free_vmemmap=on it's leaked while it's still a hugetlb folio,
> and dissolving it then loops forever, e.g., when offlining its memory
> block. Patch 2 leaks it only after the hugetlb flag is cleared, as
> without vmemmap optimization.
>
> Miaohe pointed out that unpoison_memory() then doesn't see a hugetlb
> folio anymore and unpoisons it. That already happens without vmemmap
> optimization, so patch 1 fixes it on its own and goes first.
>
> Patch 2 lets a raw_hwp_unreliable folio reach the add_hugetlb_folio()
> rollback when restoring its vmemmap fails, as
> dissolve_free_hugetlb_folio() already does. It relies on Kaitao's
> "mm/hugetlb: preserve persistent flags when returning folios to the
> pool" [1] (in mm-new) to keep the flag there.
Problem. [1] doesn't have cc:stable whereas your patches do. So we're
sending -stable people something which won't work.
I don't know if there's a way of expressing such a dependency for the
-stable machinery but fortunately [1] is still in development mode (ie,
in mm-unstable), so I can add a cc:stable to that along with an
explanatory note.
And I agree that these two patches are -stable material, especially
[2/2]. Having an offlining attempt lock up until reboot is not our
preferred user experience ;)