[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130625230938.GB30407@mtj.dyndns.org>
Date: Tue, 25 Jun 2013 16:09:38 -0700
From: Tejun Heo <tj@...nel.org>
To: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc: Dipankar Sarma <dipankar@...ibm.com>,
Fengguang Wu <fengguang.wu@...el.com>,
"David S. Miller" <davem@...emloft.net>,
Li Zefan <lizefan@...wei.com>,
Patrick McHardy <kaber@...sh.net>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rculist: list_first_or_null_rcu() should use
list_entry_rcu()
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.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists