[PATCH 0/2] generic_file_buffered_read() refactoring & optimization

From: Kent Overstreet
Date: Tue Jun 09 2020 - 20:10:57 EST


This is a small patch series that's been in the bcachefs tree for awhile.

In the buffered read path, we look up a page in the page cache, then copy from
that page in a loop - i.e. mixing the data copies in between looking up each
individual page. When we're doing large reads from the page cache, this is some
pretty major overhead.

This just reworks generic_file_buffered_read() to use find_get_pages_contig()
and work on an array of pages. It's a pretty significant performance
improvement for large buffered reads, and doesn't regress performance on single
page reads.

As a bonus, generic_file_buffered_read() gets broken up into multiple functions
that are _somewhat_ easier to follow.

Kent Overstreet (2):
fs: Break generic_file_buffered_read up into multiple functions
fs: generic_file_buffered_read() now uses find_get_pages_contig

mm/filemap.c | 486 +++++++++++++++++++++++++++++----------------------
1 file changed, 273 insertions(+), 213 deletions(-)

--
2.27.0