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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 backport/backport-include/linux/page_ref.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

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 */
-- 
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe backports" in



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux