Commit da37e368 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

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: default avatarEric 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: default avatarDavid S. Miller <davem@davemloft.net>
parent 226bd341
...@@ -108,6 +108,7 @@ struct garp_applicant { ...@@ -108,6 +108,7 @@ struct garp_applicant {
struct garp_port { struct garp_port {
struct garp_applicant __rcu *applicants[GARP_APPLICATION_MAX + 1]; struct garp_applicant __rcu *applicants[GARP_APPLICATION_MAX + 1];
struct rcu_head rcu;
}; };
extern int garp_register_application(struct garp_application *app); extern int garp_register_application(struct garp_application *app);
......
...@@ -544,6 +544,11 @@ static int garp_init_port(struct net_device *dev) ...@@ -544,6 +544,11 @@ static int garp_init_port(struct net_device *dev)
return 0; return 0;
} }
static void garp_kfree_rcu(struct rcu_head *head)
{
kfree(container_of(head, struct garp_port, rcu));
}
static void garp_release_port(struct net_device *dev) static void garp_release_port(struct net_device *dev)
{ {
struct garp_port *port = rtnl_dereference(dev->garp_port); struct garp_port *port = rtnl_dereference(dev->garp_port);
...@@ -554,8 +559,7 @@ static void garp_release_port(struct net_device *dev) ...@@ -554,8 +559,7 @@ static void garp_release_port(struct net_device *dev)
return; return;
} }
rcu_assign_pointer(dev->garp_port, NULL); rcu_assign_pointer(dev->garp_port, NULL);
synchronize_rcu(); call_rcu(&port->rcu, garp_kfree_rcu);
kfree(port);
} }
int garp_init_applicant(struct net_device *dev, struct garp_application *appl) int garp_init_applicant(struct net_device *dev, struct garp_application *appl)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment