From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jarek Poplawski <jarkao2@gmail.com>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: [PATCH net-next-2.6] net: introduce rcu_dereference_rtnl
Date: Tue, 07 Sep 2010 23:07:37 +0200 [thread overview]
Message-ID: <1283893657.2634.210.camel@edumazet-laptop> (raw)
In-Reply-To: <4C86A558.6030802@gmail.com>
Le mardi 07 septembre 2010 à 22:49 +0200, Jarek Poplawski a écrit :
> Eric Dumazet wrote, On 09/07/2010 10:11 PM:
>
> > We use rcu_dereference_check(p, rcu_read_lock_held() ||
> > lockdep_rtnl_is_held()) several times in network stack.
> >
> > More usages to come too, so its time to create a helper.
> >
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> > ---
> > include/linux/rtnetlink.h | 12 ++++++++++++
> >
> > diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
> > index 58d4449..5ba48bb 100644
> > --- a/include/linux/rtnetlink.h
> > +++ b/include/linux/rtnetlink.h
> > @@ -745,10 +745,22 @@ extern void rtnl_lock(void);
> > extern void rtnl_unlock(void);
> > extern int rtnl_trylock(void);
> > extern int rtnl_is_locked(void);
> > +
> > #ifdef CONFIG_PROVE_LOCKING
> > extern int lockdep_rtnl_is_held(void);
> > #endif /* #ifdef CONFIG_PROVE_LOCKING */
> >
> > +/**
> > + * rcu_dereference_read_lock_or_rtnl - rcu_dereference with debug checking
> > + * @p: The pointer to read, prior to dereferencing
> > + *
> > + * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
> > + * or RTNL
> > + */
> > +#define rcu_dereference_read_lock_or_rtnl(p)
>
>
> My proposal is to shorten the name, and since rcu_read_lock
> part seems obvious, maybe rcu_dereference_rtnl() only?
Yes, name is absolutely awful, I am very bad at this kind of games :)
Thanks !
[PATCH net-next-2.6] net: introduce rcu_dereference_rtnl
We use rcu_dereference_check(p, rcu_read_lock_held() ||
lockdep_rtnl_is_held()) several times in network stack.
More usages to come too, so its time to create a helper.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
include/linux/rtnetlink.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index 58d4449..057a08f 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -749,6 +749,17 @@ extern int rtnl_is_locked(void);
extern int lockdep_rtnl_is_held(void);
#endif /* #ifdef CONFIG_PROVE_LOCKING */
+/**
+ * rcu_dereference_rtnl - rcu_dereference with debug checking
+ * @p: The pointer to read, prior to dereferencing
+ *
+ * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
+ * or RTNL
+ */
+#define rcu_dereference_rtnl(p) \
+ rcu_dereference_check(p, rcu_read_lock_held() || \
+ lockdep_rtnl_is_held());
+
extern void rtnetlink_init(void);
extern void __rtnl_unlock(void);
next prev parent reply other threads:[~2010-09-07 21:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-07 20:11 [PATCH net-next-2.6] net: introduce rcu_dereference_read_lock_or_rtnl Eric Dumazet
2010-09-07 20:49 ` Jarek Poplawski
2010-09-07 21:07 ` Eric Dumazet [this message]
2010-09-08 18:29 ` [PATCH net-next-2.6] net: introduce rcu_dereference_rtnl Ben Hutchings
2010-09-08 18:44 ` Eric Dumazet
2010-09-08 21:15 ` 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=1283893657.2634.210.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--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