Skip to contentSkip to conversation

ipv4: Flush per-ns routing cache more sanely.

PATCH In review David Miller 4 participants 11 messages Oct 26, 2010 – Dec 20, 2010

Subsystems (3)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 1/1 ipv4: Flush per-ns routing cache more sanely.

Flush the routing cache only of entries that match the network namespace in which the purge event occurred.

---

Could I get some testing and performance analysis feedback on this change? I don't want it to just die :-)

THanks!

include/net/route.h +1 -1
index 7e5e73b..8d24761 100644
@@ -106,7 +106,7 @@ extern int		ip_rt_init(void);
 extern void		ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
 				       __be32 src, struct net_device *dev);
 extern void		rt_cache_flush(struct net *net, int how);
-extern void		rt_cache_flush_batch(void);
+extern void		rt_cache_flush_batch(struct net *net);
 extern int		__ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
 extern int		ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
 extern int		ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
net/ipv4/fib_frontend.c +1 -1
index 36e27c2..828d471 100644
@@ -999,7 +999,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
 		rt_cache_flush(dev_net(dev), 0);
 		break;
 	case NETDEV_UNREGISTER_BATCH:
-		rt_cache_flush_batch();
+		rt_cache_flush_batch(dev_net(dev));
 		break;
 	}
 	return NOTIFY_DONE;
net/ipv4/route.c +21 -33

88 lines not on this page · raw message

Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · David Miller

Flush the routing cache only of entries that match the network namespace in which the purge event occurred.

---

Could I get some testing and performance analysis feedback on this change? I don't want it to just die :-)

I believe its fine, thanks !

I'll respin my __rcu patch, of course.

#2 lore raw
In reply to David Miller
Quoted 9 lines · David Miller

Flush the routing cache only of entries that match the network namespace in which the purge event occurred.

---

Could I get some testing and performance analysis feedback on this change? I don't want it to just die :-)

Ok, will do in a couple of days.

Thanks
-- Daniel

#3 lore raw
In reply to David Miller
Quoted 29 lines · David Miller

Flush the routing cache only of entries that match the network namespace in which the purge event occurred.

---

Could I get some testing and performance analysis feedback on this change? I don't want it to just die :-)

THanks!

include/net/route.h +1 -1
index 7e5e73b..8d24761 100644
@@ -106,7 +106,7 @@ extern int		ip_rt_init(void);
 extern void		ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
 				       __be32 src, struct net_device *dev);
 extern void		rt_cache_flush(struct net *net, int how);
-extern void		rt_cache_flush_batch(void);
+extern void		rt_cache_flush_batch(struct net *net);
 extern int		__ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
 extern int		ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
 extern int		ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
net/ipv4/fib_frontend.c +0 -0
index 36e27c2..828d471 100644

net/ipv4/fib_frontend.c static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo · line 1002

Quoted 5 lines
net/ipv4/fib_frontend.c +1 -1
@@ -999,7 +999,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
 		rt_cache_flush(dev_net(dev), 0);
 		break;
 	case NETDEV_UNREGISTER_BATCH:
-		rt_cache_flush_batch();
+		rt_cache_flush_batch(dev_net(dev));

It still has this incorrect conversion in it.

Eric

author maintainer
#4 lore raw

From: [email protected] (Eric W. Biederman)
Date: Tue, 26 Oct 2010 12:05:39 -0700

Quoted 8 lines

net/ipv4/fib_frontend.c static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo · line 1002

Quoted 6 lines
net/ipv4/fib_frontend.c +1 -1
@@ -999,7 +999,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
 		rt_cache_flush(dev_net(dev), 0);
 		break;
 	case NETDEV_UNREGISTER_BATCH:
-		rt_cache_flush_batch();
+		rt_cache_flush_batch(dev_net(dev));

It still has this incorrect conversion in it.

Sorry I missed that, what's the exact problem with it?

#5 lore raw
Quoted 12 lines · David Miller

From: [email protected] (Eric W. Biederman)
Date: Tue, 26 Oct 2010 12:05:39 -0700

Quoted 8 lines

net/ipv4/fib_frontend.c static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo · line 1002

Quoted 6 lines
net/ipv4/fib_frontend.c +1 -1
@@ -999,7 +999,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
 		rt_cache_flush(dev_net(dev), 0);
 		break;
 	case NETDEV_UNREGISTER_BATCH:
-		rt_cache_flush_batch();
+		rt_cache_flush_batch(dev_net(dev));

It still has this incorrect conversion in it.

Quoted 1 line

Sorry I missed that, what's the exact problem with it?

Because the way _BATCH operation is performed, we call it once...

rollback_registered_many() calls it for the first dev queued in the list.

So it should be net independant.

#6 lore raw
Quoted 15 lines · Eric Dumazet
Quoted 13 lines · David Miller

From: [email protected] (Eric W. Biederman)
Date: Tue, 26 Oct 2010 12:05:39 -0700

Quoted 9 lines

net/ipv4/fib_frontend.c static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo · line 1003

Quoted 7 lines
net/ipv4/fib_frontend.c +1 -1
@@ -999,7 +999,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
  		rt_cache_flush(dev_net(dev), 0);
  		break;
  	case NETDEV_UNREGISTER_BATCH:
-		rt_cache_flush_batch();
+		rt_cache_flush_batch(dev_net(dev));
 

It still has this incorrect conversion in it.

Quoted 9 lines
Quoted 2 lines

Sorry I missed that, what's the exact problem with it?

Because the way _BATCH operation is performed, we call it once...

rollback_registered_many() calls it for the first dev queued in the list.

So it should be net independant.

Dave,

do you plan to send another version of this patch ? Or can I test it as it is ? Without removing a network device, I can check the routine, no ?

Thanks
-- Daniel

author maintainer
#7 lore raw

From: Daniel Lezcano <[email protected]>
Date: Fri, 29 Oct 2010 23:41:40 +0200

Quoted 3 lines

do you plan to send another version of this patch ? Or can I test it as it is ? Without removing a network device, I can check the routine, no ?

I'm backlogged with the current merge window work and fixing bugs, so feel free to test what I posted if you have the time.

I'll post an updated version when time permits.

Thanks.

author maintainer
#8 lore raw
In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>
Date: Tue, 26 Oct 2010 21:30:22 +0200

Quoted 13 lines · David Miller
Quoted 12 lines

From: [email protected] (Eric W. Biederman)
Date: Tue, 26 Oct 2010 12:05:39 -0700

Quoted 8 lines

Review static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo · line 1002

Quoted 6 lines
(quoted diff) +1 -1
@@ -999,7 +999,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
 		rt_cache_flush(dev_net(dev), 0);
 		break;
 	case NETDEV_UNREGISTER_BATCH:
-		rt_cache_flush_batch();
+		rt_cache_flush_batch(dev_net(dev));

It still has this incorrect conversion in it.

Quoted 8 lines
Quoted 1 line

Sorry I missed that, what's the exact problem with it?

Because the way _BATCH operation is performed, we call it once...

rollback_registered_many() calls it for the first dev queued in the list.

So it should be net independant.

Thanks Eric. I finally got back to fixing this issue and respinning the patch.

Please review, in particular how I handled the RCU bits.

--------------------
ipv4: Flush per-ns routing cache more sanely.

Flush the routing cache only of entries that match the network namespace in which the purge event occurred.

---
 include/net/route.h     |    2 +-
 net/ipv4/fib_frontend.c |    6 +++-
 net/ipv4/route.c        |   68 ++++++++++++++++++-----------------------------
 3 files changed, 32 insertions(+), 44 deletions(-)
include/net/route.h +1 -1
index 2700236..93e10c4 100644
@@ -114,7 +114,7 @@ extern int		ip_rt_init(void);
 extern void		ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw,
 				       __be32 src, struct net_device *dev);
 extern void		rt_cache_flush(struct net *net, int how);
-extern void		rt_cache_flush_batch(void);
+extern void		rt_cache_flush_batch(struct net *net);
 extern int		__ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp);
 extern int		ip_route_output_key(struct net *, struct rtable **, struct flowi *flp);
 extern int		ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags);
net/ipv4/fib_frontend.c +5 -1
index d3a1112..9f8bb68 100644
@@ -987,7 +987,11 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
 		rt_cache_flush(dev_net(dev), 0);
 		break;
 	case NETDEV_UNREGISTER_BATCH:
-		rt_cache_flush_batch();
+		/* The batch unregister is only called on the first
+		 * device in the list of devices being unregistered.
+		 * Therefore we should not pass dev_net(dev) in here.
+		 */
+		rt_cache_flush_batch(NULL);
 		break;
 	}
 	return NOTIFY_DONE;
net/ipv4/route.c +26 -42

104 lines not on this page · raw message

Signature · 1 line
1.7.3.4
Acked-by
#9 lore raw
Quoted 30 lines · David Miller

From: Eric Dumazet <[email protected]>
Date: Tue, 26 Oct 2010 21:30:22 +0200

Quoted 13 lines · David Miller
Quoted 12 lines

From: [email protected] (Eric W. Biederman)
Date: Tue, 26 Oct 2010 12:05:39 -0700

Quoted 8 lines

net/ipv4/fib_frontend.c static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo · line 1002

Quoted 6 lines
net/ipv4/fib_frontend.c +1 -1
@@ -999,7 +999,7 @@ static int fib_netdev_event(struct notifier_block *this, unsigned long event, vo
 		rt_cache_flush(dev_net(dev), 0);
 		break;
 	case NETDEV_UNREGISTER_BATCH:
-		rt_cache_flush_batch();
+		rt_cache_flush_batch(dev_net(dev));

It still has this incorrect conversion in it.

Quoted 8 lines
Quoted 1 line

Sorry I missed that, what's the exact problem with it?

Because the way _BATCH operation is performed, we call it once...

rollback_registered_many() calls it for the first dev queued in the list.

So it should be net independant.

Thanks Eric. I finally got back to fixing this issue and respinning the patch.

Please review, in particular how I handled the RCU bits.

Quoted 7 lines

--------------------
ipv4: Flush per-ns routing cache more sanely.

Flush the routing cache only of entries that match the network namespace in which the purge event occurred.

Seems fine to me, thanks !

author maintainer
#10 lore raw

From: Eric Dumazet <[email protected]>
Date: Mon, 20 Dec 2010 18:13:53 +0100

Quoted 6 lines · David Miller
Quoted 5 lines

ipv4: Flush per-ns routing cache more sanely.

Flush the routing cache only of entries that match the network namespace in which the purge event occurred.

Quoted 6 lines
Quoted 1 line

Seems fine to me, thanks !

Thanks for reviewing.