Skip to content

Commit

Permalink
net: use rcu for network scheduler API
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
stephen hemminger authored and David S. Miller committed Nov 11, 2009
1 parent 9e06759 commit f1e9016
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions net/sched/sch_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -1302,7 +1303,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
}

done:
read_unlock(&dev_base_lock);
rcu_read_unlock();

cb->args[0] = idx;
cb->args[1] = q_idx;
Expand Down

0 comments on commit f1e9016

Please sign in to comment.