Re: [PATCH 1/1] mm: prevent poison consumption when splitting THP

From: Jiaqi Yan

Date: Mon Sep 29 2025 - 11:16:00 EST


On Mon, Sep 29, 2025 at 6:57 AM Zhuo, Qiuxu <qiuxu.zhuo@xxxxxxxxx> wrote:
>
> Hi Miaohe,
>
> > From: Miaohe Lin <linmiaohe@xxxxxxxxxx>
> > [...]
> > >> First Machine Check occurs // [1]
> > >> memory_failure() // [2]
> > >> try_to_split_thp_page()
> > >> split_huge_page()
> > >> split_huge_page_to_list_to_order()
> > >> __folio_split() // [3]
> > >> remap_page()
> > >> remove_migration_ptes()
> > >> remove_migration_pte()
> > >> try_to_map_unused_to_zeropage()
> > >
> > > Just an observation: Unfortunately THP only has PageHasHWPoisoned and
> > > don't know the exact HWPoisoned page. Otherwise, we may still use
> > > zeropage for these not HWPoisoned.
> >
> > IIUC, the raw error page will have HWPoisoned flag set while the THP has
> > PageHasHWPoisoned set. So I think we could use zeropage for healthy sub-
> > pages.

Oh, sorry, somehow I forgot this so I thought there is no better place
to do the HWPoison check than in __folio_split. Yeah, since we know
the exact raw error page, checking in try_to_map_unused_to_zeropage
like David suggested is much better!

>
> Good point.
>
> David's suggested diff in another e-mail checked the raw error page instead of
> entire folio. And I tested that diff and it worked well.
>
> -Qiuxu