linux/kernel/rcu
Paul E. McKenney a792563bd4 rcu: Eliminate read-modify-write ACCESS_ONCE() calls
RCU contains code of the following forms:

	ACCESS_ONCE(x)++;
	ACCESS_ONCE(x) += y;
	ACCESS_ONCE(x) -= y;

Now these constructs do operate correctly, but they really result in a
pair of volatile accesses, one to do the load and another to do the store.
This can be confusing, as the casual reader might well assume that (for
example) gcc might generate a memory-to-memory add instruction for each
of these three cases.  In fact, gcc will do no such thing.  Also, there
is a good chance that the kernel will move to separate load and store
variants of ACCESS_ONCE(), and constructs like the above could easily
confuse both people and scripts attempting to make that sort of change.
Finally, most of RCU's read-modify-write uses of ACCESS_ONCE() really
only need the store to be volatile, so that the read-modify-write form
might be misleading.

This commit therefore changes the above forms in RCU so that each instance
of ACCESS_ONCE() either does a load or a store, but not both.  In a few
cases, ACCESS_ONCE() was not critical, for example, for maintaining
statisitics.  In these cases, ACCESS_ONCE() has been dispensed with
entirely.

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
2014-07-09 09:14:49 -07:00
..
Makefile rcutorture: Abstract rcu_torture_random() 2014-02-23 09:00:58 -08:00
rcu.h rcu: Ensure kernel/rcu/rcu.h can be sourced/used stand-alone 2014-02-26 06:35:18 -08:00
rcutorture.c torture: Check for multiple concurrent torture tests 2014-05-14 09:46:29 -07:00
srcu.c rcu: Eliminate read-modify-write ACCESS_ONCE() calls 2014-07-09 09:14:49 -07:00
tiny_plugin.h rcu: Protect uses of ->jiffies_stall with ACCESS_ONCE() 2014-04-29 08:44:41 -07:00
tiny.c rcu: Ensure kernel/rcu/rcu.h can be sourced/used stand-alone 2014-02-26 06:35:18 -08:00
tree_plugin.h rcu: Remove redundant ACCESS_ONCE() from tick_do_timer_cpu 2014-07-09 09:14:35 -07:00
tree_trace.c rcu: Stop tracking FSF's postal address 2014-02-17 15:01:37 -08:00
tree.c rcu: Eliminate read-modify-write ACCESS_ONCE() calls 2014-07-09 09:14:49 -07:00
tree.h rcu: Reduce overhead of cond_resched() checks for RCU 2014-06-23 11:19:32 -07:00
update.c rcu: Reduce overhead of cond_resched() checks for RCU 2014-06-23 11:19:32 -07:00