Re: [RFC PATCH v3 0/8] batch lookups in follow_page_mask()

From: David Hildenbrand (Arm)

Date: Wed Aug 26 2026 - 04:29:48 EST


On 8/26/26 09:35, Christoph Hellwig wrote:
> On Tue, Aug 25, 2026 at 09:39:14PM -0700, Christoph Hellwig wrote:
>> The other callers of iov_iter_extract_bvecs matter more, but this is
>> the main user.
>>
>> And iov_iter_extract_bvecs right now is very inefficient when used
>> on larger folios, as each call to iov_iter_extract_bvecs and thus
>> iov_iter_extract_pages and iov_iter_extract_user_pages can only
>> fill in up to 256 pages. On x86 that is a single PMD mapped
>> folio. Passing down the bio_vec array means that for PMD-mapped
>> ranges we reduce the calls into pin_user_pages_fast by a factor
>> of 256.
>
> Also in addition to reducing the calls to pin_user_pages_fast, it also
> removes a fair amount of work to recalculate the bio_len in the
> get_contig_folio_len loop in iov_iter_extract_bvecs, which has shown up
> in profiles (although only marginally so).

We could think of a mechanism that fills a given structure in a better way, and
I think we recently discussed returning folio ranges, and might to that through
something like phyr (or however that is called :) ).

But that's really not something is would mix into this work here.

--
Cheers,

David