Re: [PATCH RFC v4 11/12] mm/gup: batch contiguous PTE-mapped large folios in follow_page_mask()

From: Rik van Riel

Date: Mon Jul 27 2026 - 20:50:39 EST


On Mon, 2026-07-27 at 15:54 +0200, David Hildenbrand (Arm) wrote:
> On 7/25/26 00:29, Rik van Riel wrote:
> >
> >   gup_test -L -m 256 -n 65536 -r 16 -t
> >                         before      after
> >   64 kB mTHP            3140 us      412 us   (7.6x)
> >   2 MB THP (control)      78 us       76 us
> >   4 kB base (control)   3010 us     3042 us
> >
> > The PMD-mapped 2 MB THP already returns the whole mapping in one
> > step, so
> > it stays fast and unchanged. The 4 kB baseline shows the per-page
> > walk cost
> > that the 64 kB case paid before this change; only the PTE-mapped
> > large
> > folio case improves.
> >
> > Assisted-by: Claude:claude-opus-4.8
> > Signed-off-by: Rik van Riel <riel@xxxxxxxxxxx>
>
> Why is this patch part of this patch set?
>
> This makes perfect sense independently, no?

I'm happy to drop this for now. I think it would
fit in better with another optimization to only
take one refcount per continuously mapped extent
of pages from the same folio.

I can't really untangle it because it modifies
some of the same code as other patches in the
series, but I'm happy to save it for a follow-up.

--
All Rights Reversed.