Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1426986 > unrolled thread

[PATCH 02/12] net/neighbour: Employ atomic_fetch_inc()

Started byDavidlohr Bueso <dave@stgolabs.net>
First post2016-06-20 22:10 +0200
Last post2016-06-20 22:10 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 02/12] net/neighbour: Employ atomic_fetch_inc() Davidlohr Bueso <dave@stgolabs.net> - 2016-06-20 22:10 +0200

#1426986 — [PATCH 02/12] net/neighbour: Employ atomic_fetch_inc()

FromDavidlohr Bueso <dave@stgolabs.net>
Date2016-06-20 22:10 +0200
Subject[PATCH 02/12] net/neighbour: Employ atomic_fetch_inc()
Message-ID<rMdG9-4no-1@gated-at.bofh.it>
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 <davem@davemloft.net>
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web