[lkml]   [2021]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v2] mm: Stop filemap_read() from grabbing a superfluous page
On Wed, Oct 20, 2021 at 11:10:31AM +0100, David Howells wrote:
> Under some circumstances, filemap_read() will allocate sufficient pages to
> read to the end of the file, call readahead/readpages on them and copy the
> data over - and then it will allocate another page at the EOF and call
> readpage on that and then ignore it. This is unnecessary and a waste of
> time and resources.
> filemap_read() *does* check for this, but only after it has already done
> the allocation and I/O. Fix this by checking before calling
> filemap_get_pages() also.
> Changes:
> v2) Break out of the loop immediately rather than going to put_pages (the
> pvec is unoccupied). Setting isize is then unnecessary.
> Signed-off-by: David Howells <>
> cc: Kent Overstreet <>
> cc: Matthew Wilcox (Oracle) <>
> cc: Andrew Morton <>
> cc: Jeff Layton <>
> cc:
> cc:
> Link:
> Link:

Reviewed-by: Matthew Wilcox (Oracle) <>

 \ /
  Last update: 2021-10-20 13:10    [W:0.060 / U:0.656 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site