Re: [PATCH 2/2] fs: generic_file_buffered_read() now uses find_get_pages_contig

From: Jens Axboe
Date: Tue Oct 20 2020 - 10:47:44 EST


On Sat, Oct 17, 2020 at 2:11 PM Kent Overstreet <kent.overstreet@xxxxxxxxx> wrote:
>
> Convert generic_file_buffered_read() to get pages to read from in
> batches, and then copy data to userspace from many pages at once - in
> particular, we now don't touch any cachelines that might be contended
> while we're in the loop to copy data to userspace.
>
> This is is a performance improvement on workloads that do buffered reads
> with large blocksizes, and a very large performance improvement if that
> file is also being accessed concurrently by different threads.
>
> On smaller reads (512 bytes), there's a very small performance
> improvement (1%, within the margin of error).

I ran this through my buffered testing, and no ill effects observed. It
also provides a nice boost on the read side for a mixed read/write
verification workload I have.

Reviewed-by: Jens Axboe <axboe@xxxxxxxxx>

--
Jens Axboe