From: Matthew Wilcox (Oracle) Date: Sun, 9 Jan 2022 21:21:23 +0000 (-0500) Subject: mm/gup: Optimise compound_range_next() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=0b046e12ae5d6d286415a2e805fcfdd724b7add1;p=linux.git mm/gup: Optimise compound_range_next() By definition, a compound page has an order >= 1, so the second half of the test was redundant. Also, this cannot be a tail page since it's the result of calling compound_head(), so use PageHead() instead of PageCompound(). 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 32143b680a0e6..30d1daef3957b 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -260,7 +260,7 @@ static inline struct page *compound_range_next(struct page *start, next = start + i; page = compound_head(next); - if (PageCompound(page) && compound_order(page) >= 1) + if (PageHead(page)) nr = min_t(unsigned int, page + compound_nr(page) - next, npages - i);