[patch 134/159] mm/shmem: make find_get_pages_range() work for huge page

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

 



From: Yu Zhao <yuzhao@xxxxxxxxxx>
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@xxxxxxxxxx
Signed-off-by: Yu Zhao <yuzhao@xxxxxxxxxx>
Reviewed-by: William Kucharski <william.kucharski@xxxxxxxxxx>
Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
Cc: Amir Goldstein <amir73il@xxxxxxxxx>
Cc: Dave Chinner <david@xxxxxxxxxxxxx>
Cc: "Darrick J . Wong" <darrick.wong@xxxxxxxxxx>
Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
Cc: Souptick Joarder <jrdr.linux@xxxxxxxxx>
Cc: Hugh Dickins <hughd@xxxxxxxxxx>
Cc: "Kirill A . Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 mm/filemap.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/filemap.c~mm-shmem-make-find_get_pages_range-work-for-huge-page
+++ a/mm/filemap.c
@@ -1789,7 +1789,7 @@ unsigned find_get_pages_range(struct add
 
 		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
 
 		pages[ret] = page;
 		if (++ret == nr_pages) {
-			*index = page->index + 1;
+			*index = xas.xa_index + 1;
 			goto out;
 		}
 		continue;
_



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux