Skip to content

Commit 950063c

Browse files
paulmckrcuFrederic Weisbecker
authored andcommitted
rcutorture: Test srcu_expedite_current()
This commit adds a ->exp_current member to the rcu_torture_ops structure to test the srcu_expedite_current() function. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: Alexei Starovoitov <ast@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: <bpf@vger.kernel.org> Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
1 parent 34dc27f commit 950063c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

kernel/rcu/rcutorture.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ struct rcu_torture_ops {
389389
void (*deferred_free)(struct rcu_torture *p);
390390
void (*sync)(void);
391391
void (*exp_sync)(void);
392+
void (*exp_current)(void);
392393
unsigned long (*get_gp_state_exp)(void);
393394
unsigned long (*start_gp_poll_exp)(void);
394395
void (*start_gp_poll_exp_full)(struct rcu_gp_oldstate *rgosp);
@@ -857,6 +858,11 @@ static void srcu_torture_synchronize_expedited(void)
857858
synchronize_srcu_expedited(srcu_ctlp);
858859
}
859860

861+
static void srcu_torture_expedite_current(void)
862+
{
863+
srcu_expedite_current(srcu_ctlp);
864+
}
865+
860866
static struct rcu_torture_ops srcu_ops = {
861867
.ttype = SRCU_FLAVOR,
862868
.init = rcu_sync_torture_init,
@@ -871,6 +877,7 @@ static struct rcu_torture_ops srcu_ops = {
871877
.deferred_free = srcu_torture_deferred_free,
872878
.sync = srcu_torture_synchronize,
873879
.exp_sync = srcu_torture_synchronize_expedited,
880+
.exp_current = srcu_torture_expedite_current,
874881
.same_gp_state = same_state_synchronize_srcu,
875882
.get_comp_state = get_completed_synchronize_srcu,
876883
.get_gp_state = srcu_torture_get_gp_state,
@@ -919,6 +926,7 @@ static struct rcu_torture_ops srcud_ops = {
919926
.deferred_free = srcu_torture_deferred_free,
920927
.sync = srcu_torture_synchronize,
921928
.exp_sync = srcu_torture_synchronize_expedited,
929+
.exp_current = srcu_torture_expedite_current,
922930
.same_gp_state = same_state_synchronize_srcu,
923931
.get_comp_state = get_completed_synchronize_srcu,
924932
.get_gp_state = srcu_torture_get_gp_state,
@@ -1700,6 +1708,8 @@ rcu_torture_writer(void *arg)
17001708
ulo[i] = cur_ops->get_comp_state();
17011709
gp_snap = cur_ops->start_gp_poll();
17021710
rcu_torture_writer_state = RTWS_POLL_WAIT;
1711+
if (cur_ops->exp_current && !torture_random(&rand) % 0xff)
1712+
cur_ops->exp_current();
17031713
while (!cur_ops->poll_gp_state(gp_snap)) {
17041714
gp_snap1 = cur_ops->get_gp_state();
17051715
for (i = 0; i < ulo_size; i++)
@@ -1720,6 +1730,8 @@ rcu_torture_writer(void *arg)
17201730
cur_ops->get_comp_state_full(&rgo[i]);
17211731
cur_ops->start_gp_poll_full(&gp_snap_full);
17221732
rcu_torture_writer_state = RTWS_POLL_WAIT_FULL;
1733+
if (cur_ops->exp_current && !torture_random(&rand) % 0xff)
1734+
cur_ops->exp_current();
17231735
while (!cur_ops->poll_gp_state_full(&gp_snap_full)) {
17241736
cur_ops->get_gp_state_full(&gp_snap1_full);
17251737
for (i = 0; i < rgo_size; i++)

0 commit comments

Comments
 (0)