All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] inet: remove dead inetpeer sequence code
@ 2014-09-08 23:08 Willem de Bruijn
  2014-09-08 23:17 ` Eric Dumazet
  2014-09-08 23:43 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Willem de Bruijn @ 2014-09-08 23:08 UTC (permalink / raw)
  To: netdev; +Cc: davem, eric.dumazet, Willem de Bruijn

inetpeer sequence numbers are no longer incremented, so no need to
check and flush the tree. The function that increments the sequence
number was already dead code and removed in in "ipv4: remove unused
function" (068a6e18). Remove the code that checks for a change, too.

Verifying that v4_seq and v6_seq are never incremented and thus that
flush_check compares bp->flush_seq to 0 is trivial.

The second part of the change removes flush_check completely even
though bp->flush_seq is exactly !0 once, at initialization. This
change is correct because the time this branch is true is when
bp->root == peer_avl_empty_rcu, in which the branch and
inetpeer_invalidate_tree are a NOOP.

Signed-off-by: Willem de Bruijn <willemb@google.com>
---
 include/net/inetpeer.h |  1 -
 net/ipv4/inetpeer.c    | 21 ---------------------
 2 files changed, 22 deletions(-)

diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 01d590e..80479ab 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -61,7 +61,6 @@ struct inet_peer {
 struct inet_peer_base {
 	struct inet_peer __rcu	*root;
 	seqlock_t		lock;
-	u32			flush_seq;
 	int			total;
 };
 
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c
index bd5f592..241afd7 100644
--- a/net/ipv4/inetpeer.c
+++ b/net/ipv4/inetpeer.c
@@ -72,29 +72,10 @@ void inet_peer_base_init(struct inet_peer_base *bp)
 {
 	bp->root = peer_avl_empty_rcu;
 	seqlock_init(&bp->lock);
-	bp->flush_seq = ~0U;
 	bp->total = 0;
 }
 EXPORT_SYMBOL_GPL(inet_peer_base_init);
 
-static atomic_t v4_seq = ATOMIC_INIT(0);
-static atomic_t v6_seq = ATOMIC_INIT(0);
-
-static atomic_t *inetpeer_seq_ptr(int family)
-{
-	return (family == AF_INET ? &v4_seq : &v6_seq);
-}
-
-static inline void flush_check(struct inet_peer_base *base, int family)
-{
-	atomic_t *fp = inetpeer_seq_ptr(family);
-
-	if (unlikely(base->flush_seq != atomic_read(fp))) {
-		inetpeer_invalidate_tree(base);
-		base->flush_seq = atomic_read(fp);
-	}
-}
-
 #define PEER_MAXDEPTH 40 /* sufficient for about 2^27 nodes */
 
 /* Exported for sysctl_net_ipv4.  */
@@ -444,8 +425,6 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base,
 	unsigned int sequence;
 	int invalidated, gccnt = 0;
 
-	flush_check(base, daddr->family);
-
 	/* Attempt a lockless lookup first.
 	 * Because of a concurrent writer, we might not find an existing entry.
 	 */
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] inet: remove dead inetpeer sequence code
  2014-09-08 23:08 [PATCH net-next] inet: remove dead inetpeer sequence code Willem de Bruijn
@ 2014-09-08 23:17 ` Eric Dumazet
  2014-09-08 23:43 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2014-09-08 23:17 UTC (permalink / raw)
  To: Willem de Bruijn; +Cc: netdev, davem

On Mon, 2014-09-08 at 19:08 -0400, Willem de Bruijn wrote:
> inetpeer sequence numbers are no longer incremented, so no need to
> check and flush the tree. The function that increments the sequence
> number was already dead code and removed in in "ipv4: remove unused
> function" (068a6e18). Remove the code that checks for a change, too.
> 
> Verifying that v4_seq and v6_seq are never incremented and thus that
> flush_check compares bp->flush_seq to 0 is trivial.
> 
> The second part of the change removes flush_check completely even
> though bp->flush_seq is exactly !0 once, at initialization. This
> change is correct because the time this branch is true is when
> bp->root == peer_avl_empty_rcu, in which the branch and
> inetpeer_invalidate_tree are a NOOP.
> 
> Signed-off-by: Willem de Bruijn <willemb@google.com>
> ---

Acked-by: Eric Dumazet <edumazet@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] inet: remove dead inetpeer sequence code
  2014-09-08 23:08 [PATCH net-next] inet: remove dead inetpeer sequence code Willem de Bruijn
  2014-09-08 23:17 ` Eric Dumazet
@ 2014-09-08 23:43 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-09-08 23:43 UTC (permalink / raw)
  To: willemb; +Cc: netdev, eric.dumazet

From: Willem de Bruijn <willemb@google.com>
Date: Mon,  8 Sep 2014 19:08:34 -0400

> inetpeer sequence numbers are no longer incremented, so no need to
> check and flush the tree. The function that increments the sequence
> number was already dead code and removed in in "ipv4: remove unused
> function" (068a6e18). Remove the code that checks for a change, too.
> 
> Verifying that v4_seq and v6_seq are never incremented and thus that
> flush_check compares bp->flush_seq to 0 is trivial.
> 
> The second part of the change removes flush_check completely even
> though bp->flush_seq is exactly !0 once, at initialization. This
> change is correct because the time this branch is true is when
> bp->root == peer_avl_empty_rcu, in which the branch and
> inetpeer_invalidate_tree are a NOOP.
> 
> Signed-off-by: Willem de Bruijn <willemb@google.com>

Applied, thanks a lot.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-09-08 23:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-08 23:08 [PATCH net-next] inet: remove dead inetpeer sequence code Willem de Bruijn
2014-09-08 23:17 ` Eric Dumazet
2014-09-08 23:43 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.