On Wednesday 15 August 2007 15:29:43 Arnd Bergmann wrote:
> On Wednesday 15 August 2007, Paul E. McKenney wrote:
>
> > ACCESS_ONCE() is indeed intended to be used when actually loading or
> > storing the variable. That said, I must admit that it is not clear to me
> > why you would want to add an extra order() rather than ACCESS_ONCE()ing
> > one or both of the adjacent accesses to that same variable.
> >
> > So, what am I missing?
>
> You're probably right, the only case I can construct is something like
>
> if (ACCESS_ONCE(x)) {
> ...
> ACCESS_ONCE(x)++;
> }
>
> which would be slightly less efficient than
>
> if (x)
> x++;
> order(x);
>
> because in the first case, you need to do two ordered accesses
> but only one in the second case. However, I can't think of a case
> where this actually makes a noticable difference in real life.
How can this example actually get used in a sane and race-free
way? This would need locking around the whole if
statement. But locking is a barrier.
--
Greetings Michael.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]