diff mbox series

[02/12] backports: Add page_ref_count() and page_ref_sub_and_test()

Message ID 20181202115226.3594-3-hauke@hauke-m.de (mailing list archive)
State Accepted
Headers show
Series backports: Multiple fixes for kernel 4.20 | expand

Commit Message

Hauke Mehrtens Dec. 2, 2018, 11:52 a.m. UTC
This was introduced in kernel commit fe896d18789 ("mm: introduce page
reference manipulation functions") and will be used by
__page_frag_cache_drain() in the next commit.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 backport/backport-include/linux/page_ref.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/backport/backport-include/linux/page_ref.h b/backport/backport-include/linux/page_ref.h
index 55fc14f5..e45734ec 100644
--- a/backport/backport-include/linux/page_ref.h
+++ b/backport/backport-include/linux/page_ref.h
@@ -8,6 +8,16 @@  static inline void page_ref_inc(struct page *page)
 {
 	atomic_inc(&page->_count);
 }
+
+static inline int page_ref_count(struct page *page)
+{
+	return atomic_read(&page->_count);
+}
+
+static inline int page_ref_sub_and_test(struct page *page, int nr)
+{
+	return atomic_sub_and_test(nr, &page->_count);
+}
 #endif
 
 #endif /* __BP_PAGE_REF_H */