summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-01-09 16:05:11 -0500
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-03-21 12:56:34 -0400
commit8f39f5fcb7963f0a01b8077c92e627af279de65e (patch)
treea8e7a170bff74c9666e6bf26486224a9a5cae688
parente76027488640802633c646210781b63221c2fdd2 (diff)
mm/gup: Change the calling convention for compound_range_next()
Return the head page instead of storing it to a passed parameter. Pass the start page directly instead of passing a pointer to it. Reorder the arguments to match the calling function's arguments. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: William Kucharski <william.kucharski@oracle.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--mm/gup.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/mm/gup.c b/mm/gup.c
index a88133b8e758..32143b680a0e 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -252,21 +252,20 @@ void unpin_user_page(struct page *page)
}
EXPORT_SYMBOL(unpin_user_page);
-static inline void compound_range_next(unsigned long i, unsigned long npages,
- struct page **list, struct page **head,
- unsigned int *ntails)
+static inline struct page *compound_range_next(struct page *start,
+ unsigned long npages, unsigned long i, unsigned int *ntails)
{
struct page *next, *page;
unsigned int nr = 1;
- next = *list + i;
+ next = start + i;
page = compound_head(next);
if (PageCompound(page) && compound_order(page) >= 1)
nr = min_t(unsigned int,
page + compound_nr(page) - next, npages - i);
- *head = page;
*ntails = nr;
+ return page;
}
static inline void compound_next(unsigned long i, unsigned long npages,
@@ -378,7 +377,7 @@ void unpin_user_page_range_dirty_lock(struct page *page, unsigned long npages,
unsigned int ntails;
for (index = 0; index < npages; index += ntails) {
- compound_range_next(index, npages, &page, &head, &ntails);
+ head = compound_range_next(page, npages, index, &ntails);
if (make_dirty && !PageDirty(head))
set_page_dirty_lock(head);
put_compound_head(head, ntails, FOLL_PIN);