Andrew - fixup patch because I got a bug report where we were trying to do an order 7 allocation here: -- >8 -- Subject: [PATCH] fixup! fs: generic_file_buffered_read() now uses find_get_pages_contig We shouldn't try to pin too many pages at once, reads can be almost arbitrarily big. Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx> --- mm/filemap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mm/filemap.c b/mm/filemap.c index d8bd5e9647..b3a2aad1b7 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2220,8 +2220,9 @@ static ssize_t generic_file_buffered_read(struct kiocb *iocb, struct inode *inode = mapping->host; size_t orig_count = iov_iter_count(iter); struct page *pages_onstack[8], **pages = NULL; - unsigned int nr_pages = ((iocb->ki_pos + iter->count + PAGE_SIZE - 1) >> PAGE_SHIFT) - - (iocb->ki_pos >> PAGE_SHIFT); + unsigned int nr_pages = min_t(unsigned int, 512, + ((iocb->ki_pos + iter->count + PAGE_SIZE - 1) >> PAGE_SHIFT) - + (iocb->ki_pos >> PAGE_SHIFT)); int i, pg_nr, error = 0; bool writably_mapped; loff_t isize, end_offset; -- 2.27.0