From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH 08/10] ipv6: use RCU to walk list of network devices
Date: Tue, 10 Nov 2009 09:54:54 -0800 [thread overview]
Message-ID: <20091110175647.683253741@vyatta.com> (raw)
In-Reply-To: 20091110175446.280423729@vyatta.com
[-- Attachment #1: ipv6-rdlock.patch --]
[-- Type: text/plain, Size: 4200 bytes --]
No longer need read_lock(&dev_base_lock), use RCU instead.
This also needs to be optimized for large number of devices.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/net/ipv6/addrconf.c 2009-11-09 22:19:08.925480813 -0800
+++ b/net/ipv6/addrconf.c 2009-11-10 09:28:38.577438386 -0800
@@ -3828,9 +3828,9 @@ static int inet6_dump_ifinfo(struct sk_b
struct net_device *dev;
struct inet6_dev *idev;
- read_lock(&dev_base_lock);
+ rcu_read_lock();
idx = 0;
- for_each_netdev(net, dev) {
+ for_each_netdev_rcu(net, dev) {
if (idx < s_idx)
goto cont;
if ((idev = in6_dev_get(dev)) == NULL)
@@ -3843,7 +3843,7 @@ static int inet6_dump_ifinfo(struct sk_b
cont:
idx++;
}
- read_unlock(&dev_base_lock);
+ rcu_read_unlock();
cb->args[0] = idx;
return skb->len;
--- a/net/ipv6/anycast.c 2009-11-09 22:19:08.926480759 -0800
+++ b/net/ipv6/anycast.c 2009-11-10 09:28:38.577438386 -0800
@@ -431,7 +431,7 @@ static inline struct ifacaddr6 *ac6_get_
struct net *net = seq_file_net(seq);
state->idev = NULL;
- for_each_netdev(net, state->dev) {
+ for_each_netdev_rcu(net, state->dev) {
struct inet6_dev *idev;
idev = in6_dev_get(state->dev);
if (!idev)
@@ -482,9 +482,9 @@ static struct ifacaddr6 *ac6_get_idx(str
}
static void *ac6_seq_start(struct seq_file *seq, loff_t *pos)
- __acquires(dev_base_lock)
+ __acquires(rcu)
{
- read_lock(&dev_base_lock);
+ rcu_read_lock();
return ac6_get_idx(seq, *pos);
}
@@ -497,14 +497,14 @@ static void *ac6_seq_next(struct seq_fil
}
static void ac6_seq_stop(struct seq_file *seq, void *v)
- __releases(dev_base_lock)
+ __releases(rcu)
{
struct ac6_iter_state *state = ac6_seq_private(seq);
if (likely(state->idev != NULL)) {
read_unlock_bh(&state->idev->lock);
in6_dev_put(state->idev);
}
- read_unlock(&dev_base_lock);
+ rcu_read_unlock();
}
static int ac6_seq_show(struct seq_file *seq, void *v)
--- a/net/ipv6/mcast.c 2009-11-09 22:19:08.929480873 -0800
+++ b/net/ipv6/mcast.c 2009-11-10 09:28:38.578438329 -0800
@@ -2375,7 +2375,7 @@ static inline struct ifmcaddr6 *igmp6_mc
struct net *net = seq_file_net(seq);
state->idev = NULL;
- for_each_netdev(net, state->dev) {
+ for_each_netdev_rcu(net, state->dev) {
struct inet6_dev *idev;
idev = in6_dev_get(state->dev);
if (!idev)
@@ -2426,9 +2426,9 @@ static struct ifmcaddr6 *igmp6_mc_get_id
}
static void *igmp6_mc_seq_start(struct seq_file *seq, loff_t *pos)
- __acquires(dev_base_lock)
+ __acquires(rcu)
{
- read_lock(&dev_base_lock);
+ rcu_read_lock();
return igmp6_mc_get_idx(seq, *pos);
}
@@ -2441,7 +2441,7 @@ static void *igmp6_mc_seq_next(struct se
}
static void igmp6_mc_seq_stop(struct seq_file *seq, void *v)
- __releases(dev_base_lock)
+ __releases(rcu)
{
struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
if (likely(state->idev != NULL)) {
@@ -2450,7 +2450,7 @@ static void igmp6_mc_seq_stop(struct seq
state->idev = NULL;
}
state->dev = NULL;
- read_unlock(&dev_base_lock);
+ rcu_read_unlock();
}
static int igmp6_mc_seq_show(struct seq_file *seq, void *v)
@@ -2507,7 +2507,7 @@ static inline struct ip6_sf_list *igmp6_
state->idev = NULL;
state->im = NULL;
- for_each_netdev(net, state->dev) {
+ for_each_netdev_rcu(net, state->dev) {
struct inet6_dev *idev;
idev = in6_dev_get(state->dev);
if (unlikely(idev == NULL))
@@ -2573,9 +2573,9 @@ static struct ip6_sf_list *igmp6_mcf_get
}
static void *igmp6_mcf_seq_start(struct seq_file *seq, loff_t *pos)
- __acquires(dev_base_lock)
+ __acquires(rcu)
{
- read_lock(&dev_base_lock);
+ rcu_read_lock();
return *pos ? igmp6_mcf_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
@@ -2591,7 +2591,7 @@ static void *igmp6_mcf_seq_next(struct s
}
static void igmp6_mcf_seq_stop(struct seq_file *seq, void *v)
- __releases(dev_base_lock)
+ __releases(rcu)
{
struct igmp6_mcf_iter_state *state = igmp6_mcf_seq_private(seq);
if (likely(state->im != NULL)) {
@@ -2604,7 +2604,7 @@ static void igmp6_mcf_seq_stop(struct se
state->idev = NULL;
}
state->dev = NULL;
- read_unlock(&dev_base_lock);
+ rcu_read_unlock();
}
static int igmp6_mcf_seq_show(struct seq_file *seq, void *v)
--
next prev parent reply other threads:[~2009-11-10 18:08 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-10 17:54 [PATCH 00/10] netdev: get rid of read_lock(&dev_base_lock) usages Stephen Hemminger
2009-11-10 17:54 ` [PATCH 01/10] netdev: add netdev_continue_rcu Stephen Hemminger
2009-11-10 18:19 ` Eric Dumazet
2009-11-11 6:47 ` David Miller
2009-11-10 19:39 ` Paul E. McKenney
2009-11-10 17:54 ` [PATCH 02/10] vlan: eliminate use of dev_base_lock Stephen Hemminger
2009-11-10 18:20 ` Eric Dumazet
2009-11-11 6:47 ` David Miller
2009-11-10 17:54 ` [PATCH 03/10] net: use rcu for network scheduler API Stephen Hemminger
2009-11-10 18:20 ` Eric Dumazet
2009-11-11 6:47 ` David Miller
2009-11-10 17:54 ` [PATCH 04/10] AOE: use rcu to find network device Stephen Hemminger
2009-11-10 18:23 ` Eric Dumazet
2009-11-10 20:01 ` Ed Cashin
2009-11-10 23:06 ` Stephen Hemminger
2009-11-10 23:53 ` Stephen Hemminger
2009-11-11 6:48 ` David Miller
2009-11-12 14:33 ` Ed Cashin
2009-11-12 17:10 ` Stephen Hemminger
2009-11-12 18:07 ` Ed Cashin
2009-11-12 19:09 ` Stephen Hemminger
2009-11-18 16:49 ` Ed Cashin
2009-11-11 14:22 ` Ed Cashin
2009-11-13 21:39 ` Ed Cashin
2009-11-13 22:24 ` Stephen Hemminger
2009-11-10 17:54 ` [PATCH 05/10] parisc: use RCU " Stephen Hemminger
2009-11-10 18:26 ` Eric Dumazet
2009-11-11 6:48 ` David Miller
2009-11-10 17:54 ` [PATCH 06/10] s390: use RCU to walk list of network devices Stephen Hemminger
2009-11-10 18:27 ` Eric Dumazet
2009-11-10 18:29 ` Stephen Hemminger
2009-11-10 18:40 ` Eric Dumazet
2009-11-11 6:49 ` David Miller
2009-11-10 17:54 ` [PATCH 07/10] decnet: use RCU to find " Stephen Hemminger
2009-11-10 18:43 ` Eric Dumazet
2009-11-10 18:50 ` Stephen Hemminger
2009-11-10 18:24 ` steve
2009-11-11 17:39 ` [PATCH 1/2] decnet: add RTNL lock when reading address list Stephen Hemminger
2009-11-11 17:40 ` [PATCH 2/2] decnet: convert dndev_lock to spinlock Stephen Hemminger
2009-11-12 3:56 ` David Miller
2009-11-12 3:56 ` [PATCH 1/2] decnet: add RTNL lock when reading address list David Miller
2009-11-10 19:25 ` [PATCH 07/10] decnet: use RCU to find network devices Eric Dumazet
2009-11-11 6:49 ` David Miller
2009-11-10 17:54 ` Stephen Hemminger [this message]
2009-11-11 6:50 ` [PATCH 08/10] ipv6: use RCU to walk list of " David Miller
2009-11-12 3:34 ` [PATCH net-next-2.6] " Eric Dumazet
2009-11-14 4:39 ` David Miller
2009-11-10 17:54 ` [PATCH 09/10] IPV4: use rcu to walk list of devices in IGMP Stephen Hemminger
2009-11-10 18:47 ` Eric Dumazet
2009-11-11 6:50 ` David Miller
2009-11-10 17:54 ` [PATCH 10/10] CAN: use dev_get_by_index_rcu Stephen Hemminger
2009-11-10 18:34 ` Eric Dumazet
2009-11-11 5:54 ` Oliver Hartkopp
2009-11-11 6:50 ` David Miller
2009-11-10 18:18 ` [PATCH 00/10] netdev: get rid of read_lock(&dev_base_lock) usages Eric Dumazet
2009-11-10 18:22 ` Stephen Hemminger
2009-11-10 18:24 ` Stephen Hemminger
2009-11-10 18:39 ` Eric Dumazet
2009-11-10 18:53 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091110175647.683253741@vyatta.com \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).