net: use rcu for network scheduler API
authorstephen hemminger <shemminger@vyatta.com>
Tue, 10 Nov 2009 07:54:49 +0000 (07:54 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Nov 2009 06:26:30 +0000 (22:26 -0800)
Use RCU to walk list of network devices in qdisc dump.
This could be optimized for large number of devices.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_api.c

index 1acfd29cc8269e5a26422b8030623a93112533f8..876ba4bb6ae91d9f863a41300a50d476f366a3f2 100644 (file)
@@ -1279,9 +1279,10 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
 
        s_idx = cb->args[0];
        s_q_idx = q_idx = cb->args[1];
-       read_lock(&dev_base_lock);
+
+       rcu_read_lock();
        idx = 0;
-       for_each_netdev(&init_net, dev) {
+       for_each_netdev_rcu(&init_net, dev) {
                struct netdev_queue *dev_queue;
 
                if (idx < s_idx)
@@ -1302,7 +1303,7 @@ cont:
        }
 
 done:
-       read_unlock(&dev_base_lock);
+       rcu_read_unlock();
 
        cb->args[0] = idx;
        cb->args[1] = q_idx;