netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6] mac80211: Speedup ieee80211_remove_interfaces()
@ 2009-11-05 10:06 Eric Dumazet
  2009-11-05 18:40 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2009-11-05 10:06 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux Netdev List, John W. Linville

Speedup ieee80211_remove_interfaces() by factorizing synchronize_rcu() calls

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/mac80211/iface.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 14f10eb..a445f50 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -852,22 +852,18 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata)
 void ieee80211_remove_interfaces(struct ieee80211_local *local)
 {
 	struct ieee80211_sub_if_data *sdata, *tmp;
+	LIST_HEAD(unreg_list);
 
 	ASSERT_RTNL();
 
+	mutex_lock(&local->iflist_mtx);
 	list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
-		/*
-		 * we cannot hold the iflist_mtx across unregister_netdevice,
-		 * but we only need to hold it for list modifications to lock
-		 * out readers since we're under the RTNL here as all other
-		 * writers.
-		 */
-		mutex_lock(&local->iflist_mtx);
 		list_del(&sdata->list);
-		mutex_unlock(&local->iflist_mtx);
 
-		unregister_netdevice(sdata->dev);
+		unregister_netdevice_queue(sdata->dev, &unreg_list);
 	}
+	mutex_unlock(&local->iflist_mtx);
+	unregister_netdevice_many(&unreg_list);
 }
 
 static u32 ieee80211_idle_off(struct ieee80211_local *local,

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next-2.6] mac80211: Speedup ieee80211_remove_interfaces()
  2009-11-05 10:06 [PATCH net-next-2.6] mac80211: Speedup ieee80211_remove_interfaces() Eric Dumazet
@ 2009-11-05 18:40 ` Johannes Berg
  2009-11-06  8:44   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2009-11-05 18:40 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: David S. Miller, Linux Netdev List, John W. Linville

[-- Attachment #1: Type: text/plain, Size: 1833 bytes --]

On Thu, 2009-11-05 at 11:06 +0100, Eric Dumazet wrote:
> Speedup ieee80211_remove_interfaces() by factorizing synchronize_rcu() calls

Jouni will be pleased for his testing... :)

Looks good to me. Nice simplification too.

Reviewed-by: Johannes Berg <johannes@sipsolutions.net>

johannes

> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
>  net/mac80211/iface.c |   14 +++++---------
>  1 files changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
> index 14f10eb..a445f50 100644
> --- a/net/mac80211/iface.c
> +++ b/net/mac80211/iface.c
> @@ -852,22 +852,18 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata)
>  void ieee80211_remove_interfaces(struct ieee80211_local *local)
>  {
>  	struct ieee80211_sub_if_data *sdata, *tmp;
> +	LIST_HEAD(unreg_list);
>  
>  	ASSERT_RTNL();
>  
> +	mutex_lock(&local->iflist_mtx);
>  	list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
> -		/*
> -		 * we cannot hold the iflist_mtx across unregister_netdevice,
> -		 * but we only need to hold it for list modifications to lock
> -		 * out readers since we're under the RTNL here as all other
> -		 * writers.
> -		 */
> -		mutex_lock(&local->iflist_mtx);
>  		list_del(&sdata->list);
> -		mutex_unlock(&local->iflist_mtx);
>  
> -		unregister_netdevice(sdata->dev);
> +		unregister_netdevice_queue(sdata->dev, &unreg_list);
>  	}
> +	mutex_unlock(&local->iflist_mtx);
> +	unregister_netdevice_many(&unreg_list);
>  }
>  
>  static u32 ieee80211_idle_off(struct ieee80211_local *local,
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next-2.6] mac80211: Speedup ieee80211_remove_interfaces()
  2009-11-05 18:40 ` Johannes Berg
@ 2009-11-06  8:44   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2009-11-06  8:44 UTC (permalink / raw)
  To: johannes; +Cc: eric.dumazet, netdev, linville

From: Johannes Berg <johannes@sipsolutions.net>
Date: Thu, 05 Nov 2009 19:40:07 +0100

> On Thu, 2009-11-05 at 11:06 +0100, Eric Dumazet wrote:
>> Speedup ieee80211_remove_interfaces() by factorizing synchronize_rcu() calls
> 
> Jouni will be pleased for his testing... :)
> 
> Looks good to me. Nice simplification too.
> 
> Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
> 

I'll leave it to John to integrate this, thanks guys.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-11-06  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-05 10:06 [PATCH net-next-2.6] mac80211: Speedup ieee80211_remove_interfaces() Eric Dumazet
2009-11-05 18:40 ` Johannes Berg
2009-11-06  8:44   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).