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 06b819db51b18d9e3aaa8e1ada8ed8e929597143..0ff8e60deccb78a941f73163212a25b23301f871 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 8114541f327cfe5ecd7e9b7629c593f886db835f..3aabfc0adefe39863a3e7db08bf8a375a2bdd647 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 182b21825255397d8691431f7f47673b52ff79c7..01690338e3d283a1de55772219ea1703e125a34d 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 219bd197039e98b7cb1722b211722732b74abea8..4e809e978b7d274f3967349c87acda43aac57370 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);
 }