diff mbox series

[1/9] Fix khugepaged's request size in collapse_file

Message ID 20200903140844.14194-2-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series Readahead patches for 5.9/5.10 | expand

Commit Message

Matthew Wilcox (Oracle) Sept. 3, 2020, 2:08 p.m. UTC
From: David Howells <dhowells@redhat.com>

collapse_file() in khugepaged passes PAGE_SIZE as the number of pages
to be read to page_cache_sync_readahead().  The intent was probably to
read a single page.  Fix it to use the number of pages to the end of
the window instead.

Fixes: 99cb0dbd47a1 ("mm,thp: add read-only THP support for (non-shmem) FS")
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Song Liu <songliubraving@fb.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Acked-by: Yang Shi <shy828301@gmail.com>
Acked-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
 mm/khugepaged.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index e749e568e1ea..cfa0dba5fd3b 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -1709,7 +1709,7 @@  static void collapse_file(struct mm_struct *mm,
 				page_cache_sync_readahead(mapping, &file->f_ra,
 							  file, index,
-							  PAGE_SIZE);
+							  end - index);
 				/* drain pagevecs to help isolate_lru_page() */
 				page = find_lock_page(mapping, index);