diff options
author | David Hildenbrand <dahi@linux.vnet.ibm.com> | 2016-06-20 06:09:41 -0400 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2016-06-21 03:43:04 -0400 |
commit | df9b2b4a4aa49f874f8507680a533369e4b9c378 (patch) | |
tree | 8cbaaa891d43aef8565efa02add892c4901dc102 | |
parent | 3d84683bd737e397ae200e881a3230e469c59ad6 (diff) |
mm/page_ref: introduce page_ref_inc_return
Let's introduce that helper.
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Acked-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
-rw-r--r-- | include/linux/page_ref.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/page_ref.h b/include/linux/page_ref.h index 8b5e0a9f2431..610e13271918 100644 --- a/include/linux/page_ref.h +++ b/include/linux/page_ref.h | |||
@@ -124,6 +124,15 @@ static inline int page_ref_sub_and_test(struct page *page, int nr) | |||
124 | return ret; | 124 | return ret; |
125 | } | 125 | } |
126 | 126 | ||
127 | static inline int page_ref_inc_return(struct page *page) | ||
128 | { | ||
129 | int ret = atomic_inc_return(&page->_refcount); | ||
130 | |||
131 | if (page_ref_tracepoint_active(__tracepoint_page_ref_mod_and_return)) | ||
132 | __page_ref_mod_and_return(page, 1, ret); | ||
133 | return ret; | ||
134 | } | ||
135 | |||
127 | static inline int page_ref_dec_and_test(struct page *page) | 136 | static inline int page_ref_dec_and_test(struct page *page) |
128 | { | 137 | { |
129 | int ret = atomic_dec_and_test(&page->_refcount); | 138 | int ret = atomic_dec_and_test(&page->_refcount); |