Re: [PATCH 2/2] mm/madvise: use vm_normal_folio_pmd() in cold/pageout PMD range

From: Gregory Price

Date: Thu Aug 27 2026 - 14:50:42 EST


On Thu, Aug 27, 2026 at 07:07:38PM +0200, David Hildenbrand (Arm) wrote:
> On 8/21/26 16:49, Gregory Price wrote:
> >
> > Fixes: 3c8e44c9b369 ("mm: mark special bits for huge pfn mappings when inject")
> > Reported-by: sashiko-bot <sashiko-bot@xxxxxxxxxx>
> > Closes: https://sashiko.dev/#/patchset/20260817220810.1175596-1-gourry%40gourry.net
> > Cc: <stable@xxxxxxxxxxxxxxx> # v6.19+
> > Assisted-by: Claude:claude-opus-5
> > Signed-off-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
> > ---
> > mm/madvise.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/mm/madvise.c b/mm/madvise.c
> > index ffd6a68320a8..ab362bc482a5 100644
> > --- a/mm/madvise.c
> > +++ b/mm/madvise.c
> > @@ -393,7 +393,9 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd,
> > goto huge_unlock;
> > }
> >
> > - folio = pmd_folio(orig_pmd);
> > + folio = vm_normal_folio_pmd(vma, addr, orig_pmd);
> > + if (!folio)
> > + goto huge_unlock;
> I think you can now drop the is_huge_zero_pmd() check, because
> !vm_normal_folio_pmd() includes the huge zero folio.
>

I was err'ing on the side of not removing existing checks, but I can
take a look. Trivilially - I think you are right.

~Gregory