lkml.org 
[lkml]   [2010]   [Apr]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH tip/urgent] rcu: add rcu_access_pointer and rcu_dereference_protected
On Wed, Apr 07, 2010 at 06:00:27PM +0100, David Howells wrote:
> Paul E. McKenney <paulmck@linux.vnet.ibm.com> wrote:
>
> > The new rcu_access_pointer() primitive is for the case where the pointer
> > is be fetch and not dereferenced. This primitive may be used without
> > protection, RCU or otherwise, due to the fact that it uses ACCESS_ONCE().
> > ...
> > +#define rcu_access_pointer(p, c) \
>
> NAK. This shouldn't have the conditional parameter 'c'. Given that 'c' (by
> analogy to rcu_dereference_check()) is there to describe the conditions under
> which it's permitted to dereference the pointer, why is that relevant here?
> What is it you're proving?

In some cases, the value of 'c' will indeed be '1', and in those cases,
there needs to be a comment stating why it is OK, similar to those
required for smp_mb() and friends.

In other cases, there will be a reference counter or a "not yet fully
initialized" flag that can (and should) be tested.

Thanx, Paul


\
 
 \ /
  Last update: 2010-04-07 19:17    [from the cache]
©2003-2011 Jasper Spaans