Skip to content

Commit c8c3ae8

Browse files
paulmckrcuNeeraj Upadhyay
authored andcommitted
srcu: Check for concurrent updates of heuristics
SRCU maintains the ->srcu_n_exp_nodelay and ->reschedule_count values to guide heuristics governing auto-expediting of normal SRCU grace periods and grace-period-state-machine delays. This commit adds KCSAN ASSERT_EXCLUSIVE_WRITER() calls to check for concurrent updates to these fields. Signed-off-by: "Paul E. McKenney" <[email protected]> Signed-off-by: Neeraj Upadhyay <[email protected]>
1 parent 29bc83e commit c8c3ae8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/rcu/srcutree.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,7 @@ static unsigned long srcu_get_delay(struct srcu_struct *ssp)
629629
if (time_after(j, gpstart))
630630
jbase += j - gpstart;
631631
if (!jbase) {
632+
ASSERT_EXCLUSIVE_WRITER(sup->srcu_n_exp_nodelay);
632633
WRITE_ONCE(sup->srcu_n_exp_nodelay, READ_ONCE(sup->srcu_n_exp_nodelay) + 1);
633634
if (READ_ONCE(sup->srcu_n_exp_nodelay) > srcu_max_nodelay_phase)
634635
jbase = 1;
@@ -1819,6 +1820,7 @@ static void process_srcu(struct work_struct *work)
18191820
} else {
18201821
j = jiffies;
18211822
if (READ_ONCE(sup->reschedule_jiffies) == j) {
1823+
ASSERT_EXCLUSIVE_WRITER(sup->reschedule_count);
18221824
WRITE_ONCE(sup->reschedule_count, READ_ONCE(sup->reschedule_count) + 1);
18231825
if (READ_ONCE(sup->reschedule_count) > srcu_max_nodelay)
18241826
curdelay = 1;

0 commit comments

Comments
 (0)