Re: [PATCH 8/8] mm/gup: batch contiguous same-folio PTEs into one refcount grab
From: David Hildenbrand (Arm)
Date: Tue Nov 03 2026 - 13:21:01 EST
On 11/3/26 17:42, Rik van Riel wrote:
> On Tue, 2026-11-03 at 09:35 +0100, David Hildenbrand (Arm) wrote:
>> On 11/2/26 20:30, Rik van Riel wrote:
>>>
>>> +/*
>>> + * Return how many PTEs map consecutive pages of the same folio
>>> and can be
>>> + * committed as one run. Always at least 1.
>>> + *
>>> + * The write-fault and unshare checks in gup_lookup_pte() are per
>>> PTE, but a
>>> + * writable run needs no repeat: a writable anon page is
>>> exclusive. A read-only
>>> + * run under FOLL_WRITE or FOLL_PIN does need the per-page check,
>>> so it stays
>>> + * one page at a time.
>>
>> That's a clear indication that this needs more work.
>>
>> I'll try to get to it soon and see how it could be done in a cleaner
>> way, likely
>> it should be based on top of the gup-fast series where we will have
>> helpers to
>> check for required unsharing of multiple PTEs.
>
> I'm all for sharing the same helpers.
>
> How would you like to sequence things?
>
> Do you prefer to merge both series separately,
> and then get a follow-up series that merges
> the helper functions?
>
> Would you like Yeoreum Yun and me to combine
> the series, merge the helper functions beforehand,
> and then send you one larger, combined series?
>
> I have spent enough time in gup.c that I would
> be happy to get rid of some more of that code.
My plan is to get the small series for gup-fast ready, stage that, and then
build on top of it.
By then I should have been able to dig through most of your series. The cleanups
can stay part of this series.
--
Cheers,
David