From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Tejun Heo <tj@kernel.org>
Cc: Dipankar Sarma <dipankar@in.ibm.com>,
Fengguang Wu <fengguang.wu@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Li Zefan <lizefan@huawei.com>, Patrick McHardy <kaber@trash.net>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rculist: list_first_or_null_rcu() should use list_entry_rcu()
Date: Wed, 26 Jun 2013 07:17:52 -0700 [thread overview]
Message-ID: <20130626141752.GK3828@linux.vnet.ibm.com> (raw)
In-Reply-To: <20130625230938.GB30407@mtj.dyndns.org>
On Tue, Jun 25, 2013 at 04:09:38PM -0700, Tejun Heo wrote:
> Hello, Paul.
>
> On Tue, Jun 25, 2013 at 03:57:59PM -0700, Paul E. McKenney wrote:
> > > #define list_first_or_null_rcu(ptr, type, member) \
> > > ({struct list_head *__ptr = (ptr); \
> > > - struct list_head __rcu *__next = list_next_rcu(__ptr); \
> > > - likely(__ptr != __next) ? container_of(__next, type, member) : NULL; \
> > > + struct list_head *__next = __ptr->next; \
> > > + likely(__ptr != __next) ? \
> > > + list_entry_rcu(__next, type, member) : NULL; \
> >
> > I am a bit uneasy with this, and would feel better if the volatile
> > cast was on the very first fetch of the ->next pointer.
> >
> > Is there some reason why my unease is ill-founded?
>
> Do you mean something like the following?
>
> struct list_head *__next = ACCESS_ONCE(__ptr->next); \
> likely(__ptr != __next) ? \
> list_entry_rcu(__next, type, member) : NULL; \
>
> Yeah, that looks right to me.
I would feel much better about this! Does it avoid warnings in your
use cases?
Thanx, Paul
next prev parent reply other threads:[~2013-06-26 14:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-21 0:32 [PATCH] rculist: list_first_or_null_rcu() should use list_entry_rcu() Tejun Heo
2013-06-25 18:51 ` Tejun Heo
2013-06-25 22:57 ` Paul E. McKenney
2013-06-25 23:09 ` Tejun Heo
2013-06-26 14:17 ` Paul E. McKenney [this message]
2013-06-26 15:25 ` Tejun Heo
2013-06-26 17:27 ` [PATCH v2] " Tejun Heo
2013-06-28 17:24 ` Paul E. McKenney
2013-06-28 17:31 ` Tejun Heo
2013-06-28 17:34 ` [PATCH v3] " Tejun Heo
2013-06-28 19:25 ` Paul E. McKenney
2013-07-23 14:48 ` Tejun Heo
2013-07-23 15:01 ` Paul E. McKenney
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=20130626141752.GK3828@linux.vnet.ibm.com \
--to=paulmck@linux.vnet.ibm.com \
--cc=davem@davemloft.net \
--cc=dipankar@in.ibm.com \
--cc=fengguang.wu@intel.com \
--cc=kaber@trash.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=tj@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.