Skip to content

Commit 677ab23

Browse files
Frederic Weisbeckerpaulmckrcu
authored andcommitted
rcu/exp: Remove redundant full memory barrier at the end of GP
A full memory barrier is necessary at the end of the expedited grace period to order: 1) The grace period completion (pictured by the GP sequence number) with all preceding accesses. This pairs with rcu_seq_end() performed by the concurrent kworker. 2) The grace period completion and subsequent post-GP update side accesses. Pairs again against rcu_seq_end(). This full barrier is already provided by the final sync_exp_work_done() test, making the subsequent explicit one redundant. Remove it and improve comments. Signed-off-by: Frederic Weisbecker <frederic@kernel.org> Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Reviewed-by: Neeraj Upadhyay <neeraj.upadhyay@kernel.org>
1 parent 55911a9 commit 677ab23

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

kernel/rcu/tree_exp.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,12 @@ static bool sync_exp_work_done(unsigned long s)
265265
{
266266
if (rcu_exp_gp_seq_done(s)) {
267267
trace_rcu_exp_grace_period(rcu_state.name, s, TPS("done"));
268-
smp_mb(); /* Ensure test happens before caller kfree(). */
268+
/*
269+
* Order GP completion with preceding accesses. Order also GP
270+
* completion with post GP update side accesses. Pairs with
271+
* rcu_seq_end().
272+
*/
273+
smp_mb();
269274
return true;
270275
}
271276
return false;
@@ -967,7 +972,6 @@ void synchronize_rcu_expedited(void)
967972
rnp = rcu_get_root();
968973
wait_event(rnp->exp_wq[rcu_seq_ctr(s) & 0x3],
969974
sync_exp_work_done(s));
970-
smp_mb(); /* Work actions happen before return. */
971975

972976
/* Let the next expedited grace period start. */
973977
mutex_unlock(&rcu_state.exp_mutex);

0 commit comments

Comments
 (0)