mm/page_ref: use page_ref helper instead of direct modification of _count
authorJoonsoo Kim <iamjoonsoo.kim@lge.com>
Fri, 20 May 2016 00:10:46 +0000 (17:10 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 20 May 2016 02:12:14 +0000 (19:12 -0700)
page_reference manipulation functions are introduced to track down
reference count change of the page.  Use it instead of direct
modification of _count.

Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Berg <johannes@sipsolutions.net>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Sunil Goutham <sgoutham@cavium.com>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/net/ethernet/cavium/thunder/nicvf_queues.c
drivers/net/ethernet/qlogic/qede/qede_main.c
mm/filemap.c
net/wireless/util.c

index 06b819d..0ff8e60 100644 (file)
@@ -23,7 +23,7 @@ static void nicvf_get_page(struct nicvf *nic)
        if (!nic->rb_pageref || !nic->rb_page)
                return;
 
-       atomic_add(nic->rb_pageref, &nic->rb_page->_count);
+       page_ref_add(nic->rb_page, nic->rb_pageref);
        nic->rb_pageref = 0;
 }
 
index 8114541..3aabfc0 100644 (file)
@@ -920,7 +920,7 @@ static inline int qede_realloc_rx_buffer(struct qede_dev *edev,
                 * network stack to take the ownership of the page
                 * which can be recycled multiple times by the driver.
                 */
-               atomic_inc(&curr_cons->data->_count);
+               page_ref_inc(curr_cons->data);
                qede_reuse_page(edev, rxq, curr_cons);
        }
 
index 182b218..0169033 100644 (file)
@@ -213,7 +213,7 @@ void __delete_from_page_cache(struct page *page, void *shadow)
                         * some other bad page check should catch it later.
                         */
                        page_mapcount_reset(page);
-                       atomic_sub(mapcount, &page->_count);
+                       page_ref_sub(page, mapcount);
                }
        }
 
index 219bd19..4e809e9 100644 (file)
@@ -651,7 +651,7 @@ __frame_add_frag(struct sk_buff *skb, struct page *page,
        struct skb_shared_info *sh = skb_shinfo(skb);
        int page_offset;
 
-       atomic_inc(&page->_count);
+       page_ref_inc(page);
        page_offset = ptr - page_address(page);
        skb_add_rx_frag(skb, sh->nr_frags, page, page_offset, len, size);
 }