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) <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>
This commit is contained in:
Matthew Wilcox (Oracle) 2022-01-09 16:21:23 -05:00
parent 8f39f5fcb7
commit 0b046e12ae
1 changed files with 1 additions and 1 deletions

View File

@ -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);