[PATCH 05/75] mm/gup: Optimise compound_range_next()

From: Matthew Wilcox (Oracle)
Date: Fri Feb 04 2022 - 15:04:50 EST


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) <willy@xxxxxxxxxxxxx>
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
Reviewed-by: John Hubbard <jhubbard@xxxxxxxxxx>
Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
Reviewed-by: William Kucharski <william.kucharski@xxxxxxxxxx>
---
mm/gup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/gup.c b/mm/gup.c
index 26c73998c6df..75a0a1fd4c2a 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -262,7 +262,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);

--
2.34.1