linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] generic_file_buffered_read improvements
@ 2018-08-15 23:26 Kent Overstreet
  2018-08-15 23:26 ` [PATCH 1/2] fs: Break generic_file_buffered_read up into multiple functions Kent Overstreet
  2018-08-15 23:26 ` [PATCH 2/2] fs: generic_file_buffered_read() now uses find_get_pages_contig Kent Overstreet
  0 siblings, 2 replies; 11+ messages in thread
From: Kent Overstreet @ 2018-08-15 23:26 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, viro; +Cc: Kent Overstreet

Small patch series to
 - firstly, refactor generic_file_buffered_read enough that it can be modified
   in more interesting ways without going insane, and then

 - secondly, change it to use find_get_pages_contig() to batch up the page
   operations, and then copy data to userspace in a separate loop that touches
   no other shared cachelines.

I've been seeing profiles where the radix tree lookups in the buffered read path
are a shockingly large portion of the profile (around 25%, if memory serves) -
that's what this patch series is addressing. I've benchmarked small block reads
as well, performance there is unaffected or slightly improved (it's within the
margin of error).

And as a bonus, the code that was all in generic_file_buffered_read() is now
_drastically_ easier to follow and modify. I haven't done as much refactoring as
I could have, I kept as much of the structure of the old code as I could just to
make things easier on myself, but I'm still pretty happy with the result.

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.18.0


^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH 0/2] generic_file_buffered_read() refactoring & optimization
@ 2020-06-10  0:10 Kent Overstreet
  2020-06-10  0:10 ` [PATCH 2/2] fs: generic_file_buffered_read() now uses find_get_pages_contig Kent Overstreet
  0 siblings, 1 reply; 11+ messages in thread
From: Kent Overstreet @ 2020-06-10  0:10 UTC (permalink / raw)
  To: linux-kernel, akpm, viro, linux-mm, linux-fsdevel; +Cc: Kent Overstreet

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


^ permalink raw reply	[flat|nested] 11+ messages in thread
* [PATCH 0/2] generic_file_buffered_read() refactoring, perf improvements
@ 2020-10-17 20:10 Kent Overstreet
  2020-10-17 20:10 ` [PATCH 2/2] fs: generic_file_buffered_read() now uses find_get_pages_contig Kent Overstreet
  0 siblings, 1 reply; 11+ messages in thread
From: Kent Overstreet @ 2020-10-17 20:10 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel, akpm; +Cc: Kent Overstreet, willy

Rebased this patchset onto 5.9, I'd like to finally get this because
generic_file_buffered_read() has turned into a real monstrosity to work with.
And it's a major performance improvement, for both small random and large
sequential reads. On my test box, 4k buffered random reads go from ~150k to
~250k iops, and the improvements to big sequential reads are even bigger.

This incorporates the fix for IOCB_WAITQ handling that Jens just posted as well,
also factors out lock_page_for_iocb() to improve handling of the various iocb
flags.

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 | 563 ++++++++++++++++++++++++++++++---------------------
 1 file changed, 328 insertions(+), 235 deletions(-)

-- 
2.28.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-10-20 14:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-15 23:26 [PATCH 0/2] generic_file_buffered_read improvements Kent Overstreet
2018-08-15 23:26 ` [PATCH 1/2] fs: Break generic_file_buffered_read up into multiple functions Kent Overstreet
2018-08-15 23:26 ` [PATCH 2/2] fs: generic_file_buffered_read() now uses find_get_pages_contig Kent Overstreet
2018-08-16 14:56   ` kbuild test robot
2020-06-10  0:10 [PATCH 0/2] generic_file_buffered_read() refactoring & optimization Kent Overstreet
2020-06-10  0:10 ` [PATCH 2/2] fs: generic_file_buffered_read() now uses find_get_pages_contig Kent Overstreet
2020-06-10  0:47   ` Matthew Wilcox
2020-06-10  1:08     ` Kent Overstreet
2020-06-10  1:38   ` Matthew Wilcox
2020-06-10  1:46     ` Kent Overstreet
2020-10-17 20:10 [PATCH 0/2] generic_file_buffered_read() refactoring, perf improvements Kent Overstreet
2020-10-17 20:10 ` [PATCH 2/2] fs: generic_file_buffered_read() now uses find_get_pages_contig Kent Overstreet
2020-10-20 14:47   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).