From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: hadi@cyberus.ca, netdev <netdev@vger.kernel.org>,
Jarek Poplawski <jarkao2@gmail.com>
Subject: [PATCH net-next] net: relax rtnl_dereference()
Date: Mon, 04 Oct 2010 11:00:12 +0200 [thread overview]
Message-ID: <1286182812.18293.22.camel@edumazet-laptop> (raw)
In-Reply-To: <1286181729.18293.8.camel@edumazet-laptop>
Le lundi 04 octobre 2010 à 10:42 +0200, Eric Dumazet a écrit :
> BTW, rtnl_dereference() should be changed to use
> rcu_dereference_protected() instead of rcu_dereference_check() :
> If RTBL is held, there is no need to force a barrier.
>
[PATCH net-next] net: relax rtnl_dereference()
rtnl_dereference() is used in contexts where RTNL is held, to fetch an
RCU protected pointer.
Updates to this pointer are prevented by RTNL, so we dont need
smp_read_barrier_depends() and the ACCESS_ONCE() provided in
rcu_dereference_check().
rtnl_dereference() is mainly a macro to document the locking invariant.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
include/linux/rtnetlink.h | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 68c436b..d3c4efa 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -754,20 +754,22 @@ extern int lockdep_rtnl_is_held(void);
* @p: The pointer to read, prior to dereferencing
*
* Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
- * or RTNL
+ * or RTNL. Note : Please prefer rtnl_dereference() or rcu_dereference()
*/
#define rcu_dereference_rtnl(p) \
rcu_dereference_check(p, rcu_read_lock_held() || \
lockdep_rtnl_is_held())
/**
- * rtnl_dereference - rcu_dereference with debug checking
+ * rtnl_dereference - fetch RCU pointer when updates are prevented by RTNL
* @p: The pointer to read, prior to dereferencing
*
- * Do an rcu_dereference(p), but check caller holds RTNL
+ * Return the value of the specified RCU-protected pointer, but omit
+ * both the smp_read_barrier_depends() and the ACCESS_ONCE(), because
+ * caller holds RTNL.
*/
#define rtnl_dereference(p) \
- rcu_dereference_check(p, lockdep_rtnl_is_held())
+ rcu_dereference_protected(p, lockdep_rtnl_is_held())
extern void rtnetlink_init(void);
extern void __rtnl_unlock(void);
next prev parent reply other threads:[~2010-10-04 9:00 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-28 15:58 [PATCH net-next2.6] net: rename netdev rx_queue to ingress_queue Eric Dumazet
2010-09-28 18:04 ` Jarek Poplawski
2010-09-29 10:56 ` jamal
2010-09-29 13:18 ` Jarek Poplawski
2010-09-29 16:54 ` Jarek Poplawski
2010-09-30 22:58 ` [PATCH net-next2.6] net: dynamic ingress_queue allocation Eric Dumazet
2010-10-01 11:45 ` jamal
2010-10-01 13:56 ` [PATCH net-next V2] " Eric Dumazet
2010-10-02 9:32 ` Jarek Poplawski
2010-10-02 16:11 ` [PATCH net-next V3] " Eric Dumazet
2010-10-03 9:42 ` Jarek Poplawski
2010-10-03 13:10 ` jamal
2010-10-04 8:42 ` Eric Dumazet
2010-10-04 9:00 ` Eric Dumazet [this message]
2010-10-05 7:29 ` [PATCH net-next] net: relax rtnl_dereference() David Miller
2010-10-04 12:06 ` [PATCH net-next V3] net: dynamic ingress_queue allocation Jarek Poplawski
2010-10-04 12:52 ` Eric Dumazet
2010-10-04 14:24 ` Jarek Poplawski
2010-10-04 15:21 ` Eric Dumazet
2010-10-05 7:24 ` David Miller
2010-10-05 7:31 ` Eric Dumazet
2010-10-02 12:10 ` [PATCH net-next V2] " jamal
2010-09-29 20:27 ` [PATCH net-next2.6] net: rename netdev rx_queue to ingress_queue David Miller
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=1286182812.18293.22.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=hadi@cyberus.ca \
--cc=jarkao2@gmail.com \
--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