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

From: Jiaqi Yan

Date: Fri Jul 24 2026 - 23:07:18 EST


On Sun, Jul 5, 2026 at 11:50 AM Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> 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
>
>

Thanks for the reminder, Andrew! Two of the issues reported by Sashiko
actually are relevant and real, and I just replied to the mailing list
with fixes.

I will soon reply to the reviews/comments from human.