From: Matthew Wilcox (Oracle) Date: Sun, 9 Jan 2022 01:23:46 +0000 (-0500) Subject: mm/gup: Remove for_each_compound_range() X-Git-Tag: v6.1-rc5~1777^2~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a5f100db6855dbfe2709887b7348ce727e990fb6;p=platform%2Fkernel%2Flinux-starfive.git 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) Reviewed-by: Christoph Hellwig Reviewed-by: John Hubbard Reviewed-by: Jason Gunthorpe Reviewed-by: William Kucharski --- diff --git a/mm/gup.c b/mm/gup.c index eb7747b..346bfcd 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);