From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933417AbcFTUIE (ORCPT ); Mon, 20 Jun 2016 16:08:04 -0400 Received: from smtp2.provo.novell.com ([137.65.250.81]:58362 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752159AbcFTUHf (ORCPT ); Mon, 20 Jun 2016 16:07:35 -0400 From: Davidlohr Bueso To: peterz@infradead.org, mingo@kernel.org Cc: davem@davemloft.net, cw00.choi@samsung.com, dougthompson@xmission.com, bp@alien8.de, mchehab@osg.samsung.com, gregkh@linuxfoundation.org, pfg@sgi.com, jikos@kernel.org, hans.verkuil@cisco.com, awalls@md.metrocast.net, dledford@redhat.com, sean.hefty@intel.com, kys@microsoft.com, heiko.carstens@de.ibm.com, James.Bottomley@HansenPartnership.com, sumit.semwal@linaro.org, schwidefsky@de.ibm.com, linux-kernel@vger.kernel.org, dave@stgolabs.net, Davidlohr Bueso Subject: [PATCH 02/12] net/neighbour: Employ atomic_fetch_inc() Date: Mon, 20 Jun 2016 13:05:54 -0700 Message-Id: <1466453164-13185-3-git-send-email-dave@stgolabs.net> X-Mailer: git-send-email 2.6.6 In-Reply-To: <1466453164-13185-1-git-send-email-dave@stgolabs.net> References: <1466453164-13185-1-git-send-email-dave@stgolabs.net> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we have fetch_inc() we can stop using inc_return() - 1. These are very similar to the existing OP-RETURN primitives we already have, except they return the value of the atomic variable _before_ modification. Cc: David S. Miller Signed-off-by: Davidlohr Bueso --- net/core/neighbour.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/neighbour.c b/net/core/neighbour.c index 29dd8cc22bbf..60e981a8735e 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c @@ -269,7 +269,7 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl, struct net_device unsigned long now = jiffies; int entries; - entries = atomic_inc_return(&tbl->entries) - 1; + entries = atomic_fetch_inc(&tbl->entries); if (entries >= tbl->gc_thresh3 || (entries >= tbl->gc_thresh2 && time_after(now, tbl->last_flush + 5 * HZ))) { -- 2.6.6