Re: [PATCH v6 0/5] Only free healthy pages in high-order has_hwpoisoned folio
From: Andrew Morton
Date: Sun Jul 05 2026 - 14:50:56 EST
On Sun, 5 Jul 2026 18:07:09 +0000 Jiaqi Yan <jiaqiyan@xxxxxxxxxx> 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.
>
> ...
>
> Introduce free_has_hwpoisoned() to only free the healthy pages
> and exclude the HWPoison ones in the high-order folio.
> free_has_hwpoisoned() happens at the end of free_pages_prepare(),
> which already deals with both decomposing the original compound
> page, updating page metadata like alloc tag and page owner.
> It is also only applied when PG_has_hwpoisoned indicates folio
> contains certain HWPoison page(s) for performance reason.
> Its idea is to iterate through the sub-pages of the folio to
> identify contiguous ranges of healthy pages. Instead of freeing
> pages one by one, free_has_hwpoisoned() then re-use
> free_prepared_contig_range() [11] to decompose healthy ranges into
> the largest possible chunks of different orders. Every chunk is
> freed via __free_frozen_pages().
Thanks. I'll await further reviewer input before taking any action
with this series.
AI review flags several possible issues, some of them pre-existing:
https://sashiko.dev/#/patchset/20260705180714.3708947-1-jiaqiyan@xxxxxxxxxx