Skip to content

Commit

Permalink
garp: remove one synchronize_rcu() call
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Ben Greear <[email protected]>
Cc: Patrick McHardy <[email protected]>
Cc: Paul E. McKenney <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Eric Dumazet authored and davem330 committed May 9, 2011
1 parent 226bd34 commit da37e36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/net/garp.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ struct garp_applicant {

struct garp_port {
struct garp_applicant __rcu *applicants[GARP_APPLICATION_MAX + 1];
struct rcu_head rcu;
};

extern int garp_register_application(struct garp_application *app);
Expand Down
8 changes: 6 additions & 2 deletions net/802/garp.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,11 @@ static int garp_init_port(struct net_device *dev)
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)
{
struct garp_port *port = rtnl_dereference(dev->garp_port);
Expand All @@ -554,8 +559,7 @@ static void garp_release_port(struct net_device *dev)
return;
}
rcu_assign_pointer(dev->garp_port, NULL);
synchronize_rcu();
kfree(port);
call_rcu(&port->rcu, garp_kfree_rcu);
}

int garp_init_applicant(struct net_device *dev, struct garp_application *appl)
Expand Down

0 comments on commit da37e36

Please sign in to comment.