[PATCH 13/75] mm: Add folio_pincount_ptr()

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


This is the folio equivalent of compound_pincount_ptr().

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>
---
include/linux/mm.h | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index dd7d6e95e43b..d5f0f2cfd552 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -891,6 +891,11 @@ static inline void destroy_compound_page(struct page *page)
compound_page_dtors[page[1].compound_dtor](page);
}

+static inline atomic_t *folio_pincount_ptr(struct folio *folio)
+{
+ return &folio_page(folio, 1)->compound_pincount;
+}
+
static inline int head_compound_pincount(struct page *head)
{
return atomic_read(compound_pincount_ptr(head));
--
2.34.1