Re: [PATCH v2] mm: Stop filemap_read() from grabbing a superfluous page

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <dhowells@xxxxxxxxxx>
> cc: Kent Overstreet <kent.overstreet@xxxxxxxxx>
> cc: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> cc: Jeff Layton <jlayton@xxxxxxxxxx>
> cc: linux-mm@xxxxxxxxx
> cc: linux-fsdevel@xxxxxxxxxxxxxxx
> Link: https://lore.kernel.org/r/160588481358.3465195.16552616179674485179.stgit@xxxxxxxxxxxxxxxxxxxxxx/
> Link: https://lore.kernel.org/r/163456863216.2614702.6384850026368833133.stgit@xxxxxxxxxxxxxxxxxxxxxx/

Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux