Skip to content

Commit ca16265

Browse files
Frederic Weisbeckerfbq
authored andcommitted
rcu/nocb: Remove needless LOAD-ACQUIRE
The LOAD-ACQUIRE access performed on rdp->nocb_cb_sleep advertizes ordering callback execution against grace period completion. However this is contradicted by the following: * This LOAD-ACQUIRE doesn't pair with anything. The only counterpart barrier that can be found is the smp_mb() placed after callbacks advancing in nocb_gp_wait(). However the barrier is placed _after_ ->nocb_cb_sleep write. * Callbacks can be concurrently advanced between the LOAD-ACQUIRE on ->nocb_cb_sleep and the call to rcu_segcblist_extract_done_cbs() in rcu_do_batch(), making any ordering based on ->nocb_cb_sleep broken. * Both rcu_segcblist_extract_done_cbs() and rcu_advance_cbs() are called under the nocb_lock, the latter hereby providing already the desired ACQUIRE semantics. Therefore it is safe to access ->nocb_cb_sleep with a simple compiler barrier. Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Reviewed-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
1 parent 41bccc9 commit ca16265

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

kernel/rcu/tree_nocb.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -933,8 +933,7 @@ static void nocb_cb_wait(struct rcu_data *rdp)
933933
swait_event_interruptible_exclusive(rdp->nocb_cb_wq,
934934
nocb_cb_wait_cond(rdp));
935935

936-
// VVV Ensure CB invocation follows _sleep test.
937-
if (smp_load_acquire(&rdp->nocb_cb_sleep)) { // ^^^
936+
if (READ_ONCE(rdp->nocb_cb_sleep)) {
938937
WARN_ON(signal_pending(current));
939938
trace_rcu_nocb_wake(rcu_state.name, rdp->cpu, TPS("WokeEmpty"));
940939
}

0 commit comments

Comments
 (0)