Re: [PATCH RFC v4 11/12] mm/gup: batch contiguous PTE-mapped large folios in follow_page_mask()
From: David Hildenbrand (Arm)
Date: Tue Jul 28 2026 - 15:05:55 EST
On 7/28/26 02:37, Rik van Riel wrote:
> 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.
Given this series here is RFC, can't we have that optimization upfront? I'd
assume it will benefit quite some use cases that pin multiple consecutive pages.
IIUC, it'd be mostly patch 10+11. No need to worry about the test case right
now, we can do that later.
--
Cheers,
David