Re: [PATCH v6 0/5] Only free healthy pages in high-order has_hwpoisoned folio

From: David Hildenbrand (Arm)

Date: Fri Jul 17 2026 - 06:18:18 EST


On 7/5/26 20:07, Jiaqi Yan wrote:
> At the end of dissolve_free_hugetlb_folio(), a free HugeTLB
> folio becomes non-HugeTLB and is released to buddy allocator
> as a high-order folio, e.g. a folio that contains 262144 pages
> if the folio was a 1G HugeTLB hugepage.
>
> This is problematic if the HugeTLB hugepage contained HWPoison
> subpages. In that case, since buddy allocator does not check
> HWPoison for non-zero-order folio, the raw HWPoison page can
> be given out with its buddy page and be re-used by either
> kernel or userspace.

I still don't like the complexity of this, in particular, as we have different
mechanisms in the page allocator already to try handling this,

We also do have cases where we set the hwpoison bit, while a page is just about
to get allocated from the buddy. So before we take it off the buddy, we might
just hand out the page.

check_new_pages() seems to check for PageHWPoison() and make us not hand out
such pages. It's guarded by "check_pages" but it seems to do exactly what we are
looking for, now?

--
Cheers,

David