diff options
author | Hauke Mehrtens <hauke@hauke-m.de> | 2018-12-01 17:52:54 +0100 |
---|---|---|
committer | Hauke Mehrtens <hauke@hauke-m.de> | 2018-12-06 22:54:26 +0100 |
commit | dd498a8f8616c7d458a0cbb81e845d393754e7f6 (patch) | |
tree | bc03b6fa11fe7ace9078306954d8d6cf9f76994a /backport | |
parent | 9035c08635eaaf6d381fac54febf5816dcc4fae6 (diff) |
backports: Add page_ref_count() and page_ref_sub_and_test()
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>
Diffstat (limited to 'backport')
-rw-r--r-- | backport/backport-include/linux/page_ref.h | 10 |
1 files changed, 10 insertions, 0 deletions
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 */ |