lkml.org 
[lkml]   [2013]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] rculist: list_first_or_null_rcu() should use list_entry_rcu()
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



\
 
 \ /
  Last update: 2013-06-26 17:01    [W:0.070 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site