lkml.org 
[lkml]   [2010]   [Mar]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH tip/core/rcu 1/3] ftrace: replace read_barrier_depends() with rcu_dereference_raw()
From
Date
On Fri, 2010-03-05 at 17:45 -0800, Josh Triplett wrote:

> > #define rcu_assign_pointer(p, v) \
> > ({ \
> > if (!__builtin_constant_p(v) || \
> > ((v) != NULL)) \
> > smp_wmb(); \
> > (p) = (v); \
> > })
> >
> > My question is, why that crazy if? The only time that will fail is if we
> > are assigning the constant NULL to p. What makes NULL so important here?
> > Can't there be a case when assigning NULL to p will require that wmb()?
>
> The barrier ensures that the reader can't see the new p and the old
> *p. Since you can't look at *NULL, that concern doesn't apply.

Thanks for the explanation.

Question 2)

Then why the !__builtin_constant_p(v)?

If v is NULL, then the same should apply even if it is not a constant?
What am I missing?

-- Steve




\
 
 \ /
  Last update: 2010-03-06 03:01    [W:1.578 / U:0.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site