Skip to content

Commit 5f9e1bc

Browse files
paulmckrcufbq
authored andcommitted
srcu: Use ->srcu_gp_seq for rcutorture reader batch
This commit stops using ->srcu_idx for rcutorture's reader-batch consistency checking, using ->srcu_gp_seq instead. This is a first step towards a faster srcu_read_{,un}lock_lite() that avoids the array accesses that use ->srcu_idx. Signed-off-by: Paul E. McKenney <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Andrii Nakryiko <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Kent Overstreet <[email protected]> Cc: <[email protected]> Signed-off-by: Boqun Feng <[email protected]>
1 parent b459874 commit 5f9e1bc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

kernel/rcu/rcutorture.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ static struct rcu_torture_ops srcu_ops = {
791791
.readunlock = srcu_torture_read_unlock,
792792
.readlock_held = torture_srcu_read_lock_held,
793793
.get_gp_seq = srcu_torture_completed,
794+
.gp_diff = rcu_seq_diff,
794795
.deferred_free = srcu_torture_deferred_free,
795796
.sync = srcu_torture_synchronize,
796797
.exp_sync = srcu_torture_synchronize_expedited,
@@ -834,6 +835,7 @@ static struct rcu_torture_ops srcud_ops = {
834835
.readunlock = srcu_torture_read_unlock,
835836
.readlock_held = torture_srcu_read_lock_held,
836837
.get_gp_seq = srcu_torture_completed,
838+
.gp_diff = rcu_seq_diff,
837839
.deferred_free = srcu_torture_deferred_free,
838840
.sync = srcu_torture_synchronize,
839841
.exp_sync = srcu_torture_synchronize_expedited,

kernel/rcu/srcutree.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,7 @@ EXPORT_SYMBOL_GPL(srcu_barrier);
16751675
*/
16761676
unsigned long srcu_batches_completed(struct srcu_struct *ssp)
16771677
{
1678-
return READ_ONCE(ssp->srcu_idx);
1678+
return READ_ONCE(ssp->srcu_sup->srcu_gp_seq);
16791679
}
16801680
EXPORT_SYMBOL_GPL(srcu_batches_completed);
16811681

0 commit comments

Comments
 (0)