mm/page_ref: introduce page_ref_inc_return
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Mon, 20 Jun 2016 10:09:41 +0000 (12:09 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Tue, 21 Jun 2016 07:43:04 +0000 (09:43 +0200)
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>
include/linux/page_ref.h

index 8b5e0a9f2431a7b833bdb836600fe512dfbe0651..610e1327191849bf6ef5564ec1d2ddef690a0123 100644 (file)
@@ -124,6 +124,15 @@ static inline int page_ref_sub_and_test(struct page *page, int nr)
        return ret;
 }
 
+static inline int page_ref_inc_return(struct page *page)
+{
+       int ret = atomic_inc_return(&page->_refcount);
+
+       if (page_ref_tracepoint_active(__tracepoint_page_ref_mod_and_return))
+               __page_ref_mod_and_return(page, 1, ret);
+       return ret;
+}
+
 static inline int page_ref_dec_and_test(struct page *page)
 {
        int ret = atomic_dec_and_test(&page->_refcount);