net: Introduce for_each_netdev_rcu() iterator
Adds RCU management to the list of netdevices. Convert some for_each_netdev() users to RCU version, if it can avoid read_lock-ing dev_base_lock Ie: read_lock(&dev_base_loack); for_each_netdev(net, dev) some_action(); read_unlock(&dev_base_lock); becomes : rcu_read_lock(); for_each_netdev_rcu(net, dev) some_action(); rcu_read_unlock(); Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d0075634cf
commit
c6d14c8456
11 changed files with 68 additions and 77 deletions
|
@ -908,8 +908,8 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
|
|||
dev_put(dev_out);
|
||||
goto out;
|
||||
}
|
||||
read_lock(&dev_base_lock);
|
||||
for_each_netdev(&init_net, dev) {
|
||||
rcu_read_lock();
|
||||
for_each_netdev_rcu(&init_net, dev) {
|
||||
if (!dev->dn_ptr)
|
||||
continue;
|
||||
if (!dn_dev_islocal(dev, oldflp->fld_src))
|
||||
|
@ -922,7 +922,7 @@ static int dn_route_output_slow(struct dst_entry **pprt, const struct flowi *old
|
|||
dev_out = dev;
|
||||
break;
|
||||
}
|
||||
read_unlock(&dev_base_lock);
|
||||
rcu_read_unlock();
|
||||
if (dev_out == NULL)
|
||||
goto out;
|
||||
dev_hold(dev_out);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue