From 5d3ee42f8f5fa5e7ccc8980878fe6e18a129b9ff Mon Sep 17 00:00:00 2001 From: Yu Zhao Date: Tue, 5 Mar 2019 15:49:17 -0800 Subject: mm/shmem: make find_get_pages_range() work for huge page find_get_pages_range() and find_get_pages_range_tag() already correctly increment reference count on head when seeing compound page, but they may still use page index from tail. Page index from tail is always zero, so these functions don't work on huge shmem. This hasn't been a problem because, AFAIK, nobody calls these functions on (huge) shmem. Fix them anyway just in case. Link: http://lkml.kernel.org/r/20190110030838.84446-1-yuzhao@google.com Signed-off-by: Yu Zhao Reviewed-by: William Kucharski Cc: Matthew Wilcox Cc: Amir Goldstein Cc: Dave Chinner Cc: "Darrick J . Wong" Cc: Johannes Weiner Cc: Souptick Joarder Cc: Hugh Dickins Cc: "Kirill A . Shutemov" Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/filemap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mm') diff --git a/mm/filemap.c b/mm/filemap.c index ae0022f6106d..a41e01c472f3 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -1789,7 +1789,7 @@ unsigned find_get_pages_range(struct address_space *mapping, pgoff_t *start, pages[ret] = page; if (++ret == nr_pages) { - *start = page->index + 1; + *start = xas.xa_index + 1; goto out; } continue; @@ -1927,7 +1927,7 @@ unsigned find_get_pages_range_tag(struct address_space *mapping, pgoff_t *index, pages[ret] = page; if (++ret == nr_pages) { - *index = page->index + 1; + *index = xas.xa_index + 1; goto out; } continue; -- cgit v1.2.3-59-g8ed1b