OSDN Git Service

rcu: Avoid misordering in nocb_leader_wait()
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 12 Aug 2014 20:54:21 +0000 (13:54 -0700)
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Tue, 16 Sep 2014 17:08:03 +0000 (10:08 -0700)
commitc847f14217d5aec5336272a54a32ffcf6e06ddcb
tree865d138fe6a772c37c4928518b257bb14834c793
parent1772947bd0126661866069157e95197e9c0020e9
rcu: Avoid misordering in nocb_leader_wait()

The NOCB follower wakeup ordering depends on the store to the tail
pointer happening before the wakeup.  However, because atomic_long_add()
does not return a value, it does not provide ordering guarantees, and
the locking in wake_up() only guarantees that the store will happen
before the unlock, which might be too late.  Even though this is only a
theoretical issue, this commit adds a smp_mb__after_atomic() after the
final atomic_long_add() to provide the needed ordering guarantee.

Reported-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Paul Gortmaker <paul.gortmaker@windriver.com>
kernel/rcu/tree_plugin.h