summaryrefslogtreecommitdiff
path: root/include/linux/page_ref.h
diff options
context:
space:
mode:
authorMaxime Ripard <maxime@cerno.tech>2020-04-14 09:19:50 +0200
committerMaxime Ripard <maxime@cerno.tech>2020-04-14 09:19:50 +0200
commita4721ced760684d1776bf31f7925aa41bb3f4846 (patch)
treea76e23b60ecceed68b5fa4904f677fe20e304b6e /include/linux/page_ref.h
parent83a196773b8bc6702f49df1eddc848180e350340 (diff)
parent8f3d9f354286745c751374f5f1fcafee6b3f3136 (diff)
Merge v5.7-rc1 into drm-misc-fixes
Start the new drm-misc-fixes cycle. Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Diffstat (limited to 'include/linux/page_ref.h')
-rw-r--r--include/linux/page_ref.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/page_ref.h b/include/linux/page_ref.h
index 14d14beb1f7f..d27701199a4d 100644
--- a/include/linux/page_ref.h
+++ b/include/linux/page_ref.h
@@ -102,6 +102,15 @@ static inline void page_ref_sub(struct page *page, int nr)
__page_ref_mod(page, -nr);
}
+static inline int page_ref_sub_return(struct page *page, int nr)
+{
+ int ret = atomic_sub_return(nr, &page->_refcount);
+
+ if (page_ref_tracepoint_active(__tracepoint_page_ref_mod_and_return))
+ __page_ref_mod_and_return(page, -nr, ret);
+ return ret;
+}
+
static inline void page_ref_inc(struct page *page)
{
atomic_inc(&page->_refcount);