Re: [PATCH 6/24] make atomic_read() behave consistently on frv
From: Arnd Bergmann <arnd@arndb.de>
Date: 2007-08-15 14:52:28
Also in:
lkml, netdev
From: Arnd Bergmann <arnd@arndb.de>
Date: 2007-08-15 14:52:28
Also in:
lkml, netdev
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.
Arnd <><