From: Eric Dumazet <hidden> Date: 2011-05-09 13:35:59
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 <redacted>
Cc: Ben Greear <redacted>
Cc: Patrick McHardy <redacted>
Cc: Paul E. McKenney <redacted>
---
Note: I'll take care of using kfree_rcu() when available in net-next-2.6
include/net/garp.h | 1 +
net/802/garp.c | 8 ++++++--
2 files changed, 7 insertions(+), 2 deletions(-)
From: Eric Dumazet <hidden> Date: 2011-05-09 14:40:48
At VLAN dismantle phase, unregister_vlan_dev() makes one
synchronize_net() call after vlan_group_set_device(grp, vlan_id, NULL).
This call can be safely removed because we are calling
unregister_netdevice_queue() to queue device for deletion, and this
process needs at least one rcu grace period to complete.
Signed-off-by: Eric Dumazet <redacted>
Cc: Ben Greear <redacted>
Cc: Patrick McHardy <redacted>
Cc: Paul E. McKenney <redacted>
Cc: Jesse Gross <redacted>
Cc: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
include/linux/if_vlan.h | 1 -
net/8021q/vlan.c | 10 ++++------
2 files changed, 4 insertions(+), 7 deletions(-)
@@ -120,9 +120,10 @@ void unregister_vlan_dev(struct net_device *dev, struct list_head *head)grp->nr_vlans--;vlan_group_set_device(grp,vlan_id,NULL);-if(!grp->killall)-synchronize_net();-+/* Because unregister_netdevice_queue() makes sure at least one rcu+*graceperiodisrespectedbeforedevicefreeing,+*wedontneedtocallsynchronize_net()here.+*/unregister_netdevice_queue(dev,head);/* If the group is now empty, kill off the group. */
@@ -478,9 +479,6 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,if(dev->reg_state!=NETREG_UNREGISTERING)break;-/* Delete all VLANs for this dev. */-grp->killall=1;-for(i=0;i<VLAN_N_VID;i++){vlandev=vlan_group_get_device(grp,i);if(!vlandev)
On Mon, May 9, 2011 at 7:40 AM, Eric Dumazet [off-list ref] wrote:
At VLAN dismantle phase, unregister_vlan_dev() makes one
synchronize_net() call after vlan_group_set_device(grp, vlan_id, NULL).
This call can be safely removed because we are calling
unregister_netdevice_queue() to queue device for deletion, and this
process needs at least one rcu grace period to complete.
Signed-off-by: Eric Dumazet <redacted>
Cc: Ben Greear <redacted>
Cc: Patrick McHardy <redacted>
Cc: Paul E. McKenney <redacted>
Cc: Jesse Gross <redacted>
Cc: Michał Mirosław <mirq-linux@rere.qmqm.pl>
From: Patrick McHardy <hidden> Date: 2011-05-09 18:25:54
Am 09.05.2011 15:35, schrieb Eric Dumazet:
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 <redacted>
Cc: Ben Greear <redacted>
Cc: Patrick McHardy <redacted>
Cc: Paul E. McKenney <redacted>
---
Note: I'll take care of using kfree_rcu() when available in net-next-2.6
From: Patrick McHardy <hidden> Date: 2011-05-09 18:26:58
Am 09.05.2011 16:40, schrieb Eric Dumazet:
quoted hunk
At VLAN dismantle phase, unregister_vlan_dev() makes one
synchronize_net() call after vlan_group_set_device(grp, vlan_id, NULL).
This call can be safely removed because we are calling
unregister_netdevice_queue() to queue device for deletion, and this
process needs at least one rcu grace period to complete.
Signed-off-by: Eric Dumazet <redacted>
Cc: Ben Greear <redacted>
Cc: Patrick McHardy <redacted>
Cc: Paul E. McKenney <redacted>
Cc: Jesse Gross <redacted>
Cc: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
include/linux/if_vlan.h | 1 -
net/8021q/vlan.c | 10 ++++------
2 files changed, 4 insertions(+), 7 deletions(-)
From: David Miller <davem@davemloft.net> Date: 2011-05-09 18:42:40
From: Eric Dumazet <redacted>
Date: Mon, 09 May 2011 15:35:55 +0200
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 <redacted>
From: David Miller <davem@davemloft.net> Date: 2011-05-09 18:42:46
From: Eric Dumazet <redacted>
Date: Mon, 09 May 2011 16:40:44 +0200
At VLAN dismantle phase, unregister_vlan_dev() makes one
synchronize_net() call after vlan_group_set_device(grp, vlan_id, NULL).
This call can be safely removed because we are calling
unregister_netdevice_queue() to queue device for deletion, and this
process needs at least one rcu grace period to complete.
Signed-off-by: Eric Dumazet <redacted>
From: Eric Dumazet <hidden> Date: 2011-05-12 13:29:32
Le lundi 09 mai 2011 à 20:25 +0200, Patrick McHardy a écrit :
Am 09.05.2011 15:35, schrieb Eric Dumazet:
quoted
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 <redacted>
Cc: Ben Greear <redacted>
Cc: Patrick McHardy <redacted>
Cc: Paul E. McKenney <redacted>
---
Note: I'll take care of using kfree_rcu() when available in net-next-2.6
Looks good to me.
Here is a followup on this patch, thanks !
[PATCH net-next-2.6] garp: remove last synchronize_rcu() call
When removing last vlan from a device, garp_uninit_applicant() calls
synchronize_rcu() to make sure no user can still manipulate struct
garp_applicant before we free it.
Use call_rcu() instead, as a step to further net_device dismantle
optimizations.
Add the temporary garp_cleanup_module() function to make sure no pending
call_rcu() are left at module unload time [ this will be removed when
kfree_rcu() is available ]
Signed-off-by: Eric Dumazet <redacted>
Cc: Patrick McHardy <redacted>
Cc: Paul E. McKenney <redacted>
Cc: Ben Greear <redacted>
---
include/net/garp.h | 1 +
net/802/garp.c | 14 ++++++++++++--
2 files changed, 13 insertions(+), 2 deletions(-)
From: David Miller <davem@davemloft.net> Date: 2011-05-12 21:49:30
From: Eric Dumazet <redacted>
Date: Thu, 12 May 2011 15:29:17 +0200
[PATCH net-next-2.6] garp: remove last synchronize_rcu() call
When removing last vlan from a device, garp_uninit_applicant() calls
synchronize_rcu() to make sure no user can still manipulate struct
garp_applicant before we free it.
Use call_rcu() instead, as a step to further net_device dismantle
optimizations.
Add the temporary garp_cleanup_module() function to make sure no pending
call_rcu() are left at module unload time [ this will be removed when
kfree_rcu() is available ]
Signed-off-by: Eric Dumazet <redacted>