Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rcu: Remove READ_ONCE() for rdp->gpwrap access in __note_gp_changes()

There is one access to the per-CPU rdp->gpwrap field in the
__note_gp_changes() function that does not use READ_ONCE(), but all other
accesses do use READ_ONCE(). When using the 8*TREE03 and CONFIG_NR_CPUS=8
configuration, KCSAN found no data races at that point. This is because
all calls to __note_gp_changes() hold rnp->lock, which excludes writes
to the rdp->gpwrap fields for all CPUs associated with that same leaf
rcu_node structure.

This commit therefore removes READ_ONCE() from rdp->gpwrap accesses
within the __note_gp_changes() function.

Signed-off-by: Zilin Guan <zilinguan811@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>

authored by

Zilin Guan and committed by
Boqun Feng
764f6a81 a3e81621

+3 -3
+3 -3
kernel/rcu/tree.c
··· 1254 1254 1255 1255 /* Handle the ends of any preceding grace periods first. */ 1256 1256 if (rcu_seq_completed_gp(rdp->gp_seq, rnp->gp_seq) || 1257 - unlikely(READ_ONCE(rdp->gpwrap))) { 1257 + unlikely(rdp->gpwrap)) { 1258 1258 if (!offloaded) 1259 1259 ret = rcu_advance_cbs(rnp, rdp); /* Advance CBs. */ 1260 1260 rdp->core_needs_qs = false; ··· 1268 1268 1269 1269 /* Now handle the beginnings of any new-to-this-CPU grace periods. */ 1270 1270 if (rcu_seq_new_gp(rdp->gp_seq, rnp->gp_seq) || 1271 - unlikely(READ_ONCE(rdp->gpwrap))) { 1271 + unlikely(rdp->gpwrap)) { 1272 1272 /* 1273 1273 * If the current grace period is waiting for this CPU, 1274 1274 * set up to detect a quiescent state, otherwise don't ··· 1283 1283 rdp->gp_seq = rnp->gp_seq; /* Remember new grace-period state. */ 1284 1284 if (ULONG_CMP_LT(rdp->gp_seq_needed, rnp->gp_seq_needed) || rdp->gpwrap) 1285 1285 WRITE_ONCE(rdp->gp_seq_needed, rnp->gp_seq_needed); 1286 - if (IS_ENABLED(CONFIG_PROVE_RCU) && READ_ONCE(rdp->gpwrap)) 1286 + if (IS_ENABLED(CONFIG_PROVE_RCU) && rdp->gpwrap) 1287 1287 WRITE_ONCE(rdp->last_sched_clock, jiffies); 1288 1288 WRITE_ONCE(rdp->gpwrap, false); 1289 1289 rcu_gpnum_ovf(rnp, rdp);