Skip to content

Commit 59881bc

Browse files
committed
rcu: Add WRITE_ONCE() to rcu_state ->gp_start
The rcu_state structure's ->gp_start field is read locklessly, so this commit adds the WRITE_ONCE() to an update in order to provide proper documentation and READ_ONCE()/WRITE_ONCE() pairing. This data race was reported by KCSAN. Not appropriate for backporting due to failure being unlikely. Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 57721fd commit 59881bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/rcu/tree_stall.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static void record_gp_stall_check_time(void)
102102
unsigned long j = jiffies;
103103
unsigned long j1;
104104

105-
rcu_state.gp_start = j;
105+
WRITE_ONCE(rcu_state.gp_start, j);
106106
j1 = rcu_jiffies_till_stall_check();
107107
/* Record ->gp_start before ->jiffies_stall. */
108108
smp_store_release(&rcu_state.jiffies_stall, j + j1); /* ^^^ */

0 commit comments

Comments
 (0)