summaryrefslogtreecommitdiffstats
path: root/mm/gup.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-01-08 20:23:46 -0500
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-03-21 12:56:34 -0400
commita5f100db6855dbfe2709887b7348ce727e990fb6 (patch)
tree2387a0559d83a421789893eb9e8c4b070585e3a6 /mm/gup.c
parent8ea2979c1444cd455ddbe7f976de79cc09fdc38d (diff)
downloadlinux-a5f100db6855dbfe2709887b7348ce727e990fb6.tar.gz
linux-a5f100db6855dbfe2709887b7348ce727e990fb6.tar.bz2
linux-a5f100db6855dbfe2709887b7348ce727e990fb6.zip
mm/gup: Remove for_each_compound_range()
This macro doesn't simplify the users; it's easier to just call compound_range_next() inside the loop. 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.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/mm/gup.c b/mm/gup.c
index eb7747bc7f7d..346bfcd6652b 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -259,9 +259,6 @@ static inline void compound_range_next(unsigned long i, unsigned long npages,
struct page *next, *page;
unsigned int nr = 1;
- if (i >= npages)
- return;
-
next = *list + i;
page = compound_head(next);
if (PageCompound(page) && compound_order(page) >= 1)
@@ -272,12 +269,6 @@ static inline void compound_range_next(unsigned long i, unsigned long npages,
*ntails = nr;
}
-#define for_each_compound_range(__i, __list, __npages, __head, __ntails) \
- for (__i = 0, \
- compound_range_next(__i, __npages, __list, &(__head), &(__ntails)); \
- __i < __npages; __i += __ntails, \
- compound_range_next(__i, __npages, __list, &(__head), &(__ntails)))
-
static inline void compound_next(unsigned long i, unsigned long npages,
struct page **list, struct page **head,
unsigned int *ntails)
@@ -394,7 +385,8 @@ void unpin_user_page_range_dirty_lock(struct page *page, unsigned long npages,
struct page *head;
unsigned int ntails;
- for_each_compound_range(index, &page, npages, head, ntails) {
+ for (index = 0; index < npages; index += ntails) {
+ compound_range_next(index, npages, &page, &head, &ntails);
if (make_dirty && !PageDirty(head))
set_page_dirty_lock(head);
put_compound_head(head, ntails, FOLL_PIN);