Re: [PATCH v5 1/2] filemap: add helper mapping_max_folio_size()

Ritesh Harjani
2024-05-24T06:39:40Z

Christian Brauner <brauner@kernel.org> writes:

> On Tue, 21 May 2024 19:49:38 +0800, Xu Yang wrote:
>> Add mapping_max_folio_size() to get the maximum folio size for this
>> pagecache mapping.
>>
>>
>
> Applied to the vfs.fixes branch of the vfs/vfs.git tree.
> Patches in the vfs.fixes branch should appear in linux-next soon.
>
> Please report any outstanding bugs that were missed during review in a
> new review to the original patch series allowing us to drop it.
>
> It's encouraged to provide Acked-bys and Reviewed-bys even though the
> patch has now been applied. If possible patch trailers will be updated.

iomap_write_iter() prefaults in userspace buffer chunk bytes (order
MAX_PAGECACHE_ORDER) at a time.
However, the iomap_write_begin() function only handles writes for
PAGE_SIZE bytes at a time for mappings which does not support large
folios. Hence, this causes unnecessary loops of prefaults in
iomap_write_iter() -> fault_in_iov_iter_readable(), causing performance
hits for block device mappings.

This patch fixes iomap_write_iter() to prefault in PAGE_SIZE chunk
bytes.

I guess this change will then go back to v6.6 when large folios got added to iomap.

Looks good to me. Please feel free add -
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>

>
> Note that commit hashes shown below are subject to change due to rebase,
> trailer updates or similar. If in doubt, please check the listed branch.
>
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
> branch: vfs.fixes
>
> [1/2] filemap: add helper mapping_max_folio_size()
> https://git.kernel.org/vfs/vfs/c/0c31d63eebdd
> [2/2] iomap: fault in smaller chunks for non-large folio mappings
> https://git.kernel.org/vfs/vfs/c/63ba6f07d115