summaryrefslogtreecommitdiffstats
path: root/mm/gup.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-01-07 19:45:25 +0100
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-03-21 17:56:35 +0100
commit4c65422901154766e5cee17875ed680366a4a141 (patch)
treedbca9698daccdecf9a37dda282750cb3be3aef8a /mm/gup.c
parentmm/gup: Fix some contiguous memmap assumptions (diff)
downloadlinux-4c65422901154766e5cee17875ed680366a4a141.tar.xz
linux-4c65422901154766e5cee17875ed680366a4a141.zip
mm/gup: Remove an assumption of a contiguous memmap
This assumption needs the inverse of nth_page(), which is temporarily named page_nth() until it's renamed later in this series. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: William Kucharski <william.kucharski@oracle.com>
Diffstat (limited to 'mm/gup.c')
-rw-r--r--mm/gup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mm/gup.c b/mm/gup.c
index d585aa06afb2..ad120f470735 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -261,8 +261,8 @@ static inline struct page *compound_range_next(struct page *start,
next = nth_page(start, i);
page = compound_head(next);
if (PageHead(page))
- nr = min_t(unsigned int,
- page + compound_nr(page) - next, npages - i);
+ nr = min_t(unsigned int, npages - i,
+ compound_nr(page) - page_nth(page, next));
*ntails = nr;
return page;