Skip to content

Commit 43349fc

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
rcutorture: Add srcu_read_lock_lite() support to rcutorture.reader_flavor
This commit causes bit 0x4 of rcutorture.reader_flavor to select the new srcu_read_lock_lite() and srcu_read_unlock_lite() functions. 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]> Reviewed-by: Neeraj Upadhyay <[email protected]> Signed-off-by: Frederic Weisbecker <[email protected]>
1 parent 95a5de2 commit 43349fc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5431,8 +5431,8 @@
54315431
If there is more than one bit set, the readers
54325432
are entered from low-order bit up, and are
54335433
exited in the opposite order. For SRCU, the
5434-
0x1 bit is normal readers and the 0x2 bit is
5435-
for NMI-safe readers.
5434+
0x1 bit is normal readers, 0x2 NMI-safe readers,
5435+
and 0x4 light-weight readers.
54365436

54375437
rcutorture.shuffle_interval= [KNL]
54385438
Set task-shuffle interval (s). Shuffling tasks

kernel/rcu/rcutorture.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,11 @@ static int srcu_torture_read_lock(void)
658658
WARN_ON_ONCE(idx & ~0x1);
659659
ret += idx << 1;
660660
}
661+
if (reader_flavor & 0x4) {
662+
idx = srcu_read_lock_lite(srcu_ctlp);
663+
WARN_ON_ONCE(idx & ~0x1);
664+
ret += idx << 2;
665+
}
661666
return ret;
662667
}
663668

@@ -683,6 +688,8 @@ srcu_read_delay(struct torture_random_state *rrsp, struct rt_read_seg *rtrsp)
683688
static void srcu_torture_read_unlock(int idx)
684689
{
685690
WARN_ON_ONCE((reader_flavor && (idx & ~reader_flavor)) || (!reader_flavor && (idx & ~0x1)));
691+
if (reader_flavor & 0x4)
692+
srcu_read_unlock_lite(srcu_ctlp, (idx & 0x4) >> 2);
686693
if (reader_flavor & 0x2)
687694
srcu_read_unlock_nmisafe(srcu_ctlp, (idx & 0x2) >> 1);
688695
if ((reader_flavor & 0x1) || !(reader_flavor & 0x7))

0 commit comments

Comments
 (0)