Re: [PATCH v2 2/4] mm: don't PTE-batch a swap-in of a folio with a hardware-poisoned page
From: Zi Yan
Date: Mon Nov 16 2026 - 14:31:59 EST
On 16 Nov 2026, at 1:34, Usama Arif wrote:
> do_swap_page() checks PageHWPoison() on the faulting page, but the
> large-folio batching path then maps the rest of the folio without
> looking at its other pages. A poisoned page that is not the one being
> faulted gets mapped anyway, and the fault that would have reported it
> never happens.
>
> Skip batching for such an anon folio and let each page take its own
> fault, where the existing check catches it. do_set_pmd() already backs
> off the same way.
>
> Leave a freshly read folio alone: it is not anon yet and can only be
> mapped as a whole, and falling back would free it with the poisoned
> page still in it, which the retried fault can then get back from the
> page allocator.
>
> Fixes: 508758960b8d ("mm: swap: entirely map large folios found in swapcache")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Usama Arif <usama.arif@xxxxxxxxx>
> ---
> mm/memory.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
Like David suggested, it probably can be placed before folio_pte_range().
With that change, feel free to add
Reviewed-by: Zi Yan <ziy@xxxxxxxxxx>
Thanks.
Best Regards,
Yan, Zi