aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-05-08 23:35:55 -0400
committerDavid S. Miller <davem@davemloft.net>2011-05-09 14:41:40 -0400
commitda37e368763f708d2ae5a81e61ec59372b831cf5 (patch)
tree0ee4b0509caca004aee6a69000d69d67c8bc0eef
parent226bd3411471af42f7edbdfaf73f2d54ebb62a66 (diff)
garp: remove one synchronize_rcu() call
Speedup vlan dismantling in CONFIG_VLAN_8021Q_GVRP=y cases, by using a call_rcu() to free the memory instead of waiting with expensive synchronize_rcu() [ while RTNL is held ] Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Cc: Ben Greear <greearb@candelatech.com> Cc: Patrick McHardy <kaber@trash.net> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/garp.h1
-rw-r--r--net/802/garp.c8
2 files changed, 7 insertions, 2 deletions
diff --git a/include/net/garp.h b/include/net/garp.h
index f4c295984c45..8cabbf087169 100644
--- a/include/net/garp.h
+++ b/include/net/garp.h
@@ -108,6 +108,7 @@ struct garp_applicant {
108 108
109struct garp_port { 109struct garp_port {
110 struct garp_applicant __rcu *applicants[GARP_APPLICATION_MAX + 1]; 110 struct garp_applicant __rcu *applicants[GARP_APPLICATION_MAX + 1];
111 struct rcu_head rcu;
111}; 112};
112 113
113extern int garp_register_application(struct garp_application *app); 114extern int garp_register_application(struct garp_application *app);
diff --git a/net/802/garp.c b/net/802/garp.c
index c1df2dad8c6b..5dbe8967bbd5 100644
--- a/net/802/garp.c
+++ b/net/802/garp.c
@@ -544,6 +544,11 @@ static int garp_init_port(struct net_device *dev)
544 return 0; 544 return 0;
545} 545}
546 546
547static void garp_kfree_rcu(struct rcu_head *head)
548{
549 kfree(container_of(head, struct garp_port, rcu));
550}
551
547static void garp_release_port(struct net_device *dev) 552static void garp_release_port(struct net_device *dev)
548{ 553{
549 struct garp_port *port = rtnl_dereference(dev->garp_port); 554 struct garp_port *port = rtnl_dereference(dev->garp_port);
@@ -554,8 +559,7 @@ static void garp_release_port(struct net_device *dev)
554 return; 559 return;
555 } 560 }
556 rcu_assign_pointer(dev->garp_port, NULL); 561 rcu_assign_pointer(dev->garp_port, NULL);
557 synchronize_rcu(); 562 call_rcu(&port->rcu, garp_kfree_rcu);
558 kfree(port);
559} 563}
560 564
561int garp_init_applicant(struct net_device *dev, struct garp_application *appl) 565int garp_init_applicant(struct net_device *dev, struct garp_application *appl)