[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1412875428.18196.3.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Thu, 09 Oct 2014 10:23:48 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: David Miller <davem@...emloft.net>
Cc: netdev <netdev@...r.kernel.org>
Subject: [PATCH net] niu: remove unnecessary atomic operation
From: Eric Dumazet <edumazet@...gle.com>
We allocate single page, compound_head() is not needed.
We own the page, we can simply set page->_count to the
needed value instead of doing a locked addition.
Signed-off-by: Eric Dumazet <edumazet@...gle.com>
---
drivers/net/ethernet/sun/niu.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c
index 904fd1ab5f6e..ec2cd8a6d5bc 100644
--- a/drivers/net/ethernet/sun/niu.c
+++ b/drivers/net/ethernet/sun/niu.c
@@ -3340,9 +3340,8 @@ static int niu_rbr_add_page(struct niu *np, struct rx_ring_info *rp,
}
niu_hash_page(rp, page, addr);
- if (rp->rbr_blocks_per_page > 1)
- atomic_add(rp->rbr_blocks_per_page - 1,
- &compound_head(page)->_count);
+
+ atomic_set(&page->_count, rp->rbr_blocks_per_page);
for (i = 0; i < rp->rbr_blocks_per_page; i++) {
__le32 *rbr = &rp->rbr[start_index + i];
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists