Skip to content

Commit e5a59d3

Browse files
dhowellstorvalds
authored andcommitted
mm/khugepaged.c: fix khugepaged's request size in collapse_file
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: 99cb0db ("mm,thp: add read-only THP support for (non-shmem) FS") Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Acked-by: Song Liu <songliubraving@fb.com> Acked-by: Yang Shi <shy828301@gmail.com> Acked-by: Pankaj Gupta <pankaj.gupta.linux@gmail.com> Cc: Eric Biggers <ebiggers@google.com> Link: https://lkml.kernel.org/r/20200903140844.14194-2-willy@infradead.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 1774379 commit e5a59d3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/khugepaged.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ static void collapse_file(struct mm_struct *mm,
17091709
xas_unlock_irq(&xas);
17101710
page_cache_sync_readahead(mapping, &file->f_ra,
17111711
file, index,
1712-
PAGE_SIZE);
1712+
end - index);
17131713
/* drain pagevecs to help isolate_lru_page() */
17141714
lru_add_drain();
17151715
page = find_lock_page(mapping, index);

0 commit comments

Comments
 (0)