On 1/2/22 13:57, Matthew Wilcox (Oracle) wrote:
Convert hpage_pincount_available() into folio_pincount_available() and
turn hpage_pincount_available() into a wrapper. We don't need to
check folio_test_large() before checking folio_order() as
folio_order() includes a check of folio_test_large().
Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
---
include/linux/mm.h | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 98a10412d581..269b5484d66e 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -927,15 +927,19 @@ static inline void destroy_compound_page(struct page *page)
compound_page_dtors[page[1].compound_dtor](page);
}
-static inline bool hpage_pincount_available(struct page *page)
+static inline bool folio_pincount_available(struct folio *folio)
{
/*
- * Can the page->hpage_pinned_refcount field be used? That field is in
+ * Can the folio->hpage_pinned_refcount field be used? That field is in
* the 3rd page of the compound page, so the smallest (2-page) compound
* pages cannot support it.
*/
- page = compound_head(page);
- return PageCompound(page) && compound_order(page) > 1;
+ return folio_order(folio) > 1;
I see, no need to look at the compound page head, because folio_order() returns
zero for tail pages, and neatly avoids all of that.
+}
+
+static inline bool hpage_pincount_available(struct page *page)
+{
+ return folio_pincount_available(page_folio(page));
}
static inline int head_compound_pincount(struct page *head)
Reviewed-by: John Hubbard <jhubbard@xxxxxxxxxx>
thanks,
--
John Hubbard
NVIDIA