Skip to contentSkip to conversation

mac80211: Speedup ieee80211_remove_interfaces()

PATCH In review Eric Dumazet 3 participants 3 messages Nov 5, 2009 – Nov 6, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: Speedup ieee80211_remove_interfaces()

Speedup ieee80211_remove_interfaces() by factorizing synchronize_rcu() calls

---
 net/mac80211/iface.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
net/mac80211/iface.c +5 -9
index 14f10eb..a445f50 100644
@@ -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,
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 1 line · Eric Dumazet

Speedup ieee80211_remove_interfaces() by factorizing synchronize_rcu() calls

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

Looks good to me. Nice simplification too.

johannes

Quoted 43 lines
---
 net/mac80211/iface.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
net/mac80211/iface.c +5 -10
index 14f10eb..a445f50 100644
@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#2 lore raw

From: Johannes Berg <[email protected]>
Date: Thu, 05 Nov 2009 19:40:07 +0100

Quoted 9 lines · Eric Dumazet
Quoted 1 line

Speedup ieee80211_remove_interfaces() by factorizing synchronize_rcu() calls

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

Looks good to me. Nice simplification too.

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