Re: [RFC PATCH v3 0/8] batch lookups in follow_page_mask()
From: Christoph Hellwig
Date: Wed Aug 26 2026 - 03:38:48 EST
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).