Skip to content

Commit 1c67318

Browse files
Zqiangurezki
authored andcommitted
rcutorture: Use rcu_gp_slow_register/unregister() only for rcutype test
The rcu_gp_slow_register/unregister() is only useful in tests where torture_type=rcu, so this commit therefore generates ->gp_slow_register() and ->gp_slow_unregister() function pointers in the rcu_torture_ops structure, and slows grace periods only when these function pointers exist. Signed-off-by: Zqiang <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]> Signed-off-by: Uladzislau Rezki (Sony) <[email protected]>
1 parent 39988fd commit 1c67318

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

kernel/rcu/rcutorture.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,8 @@ struct rcu_torture_ops {
382382
bool (*check_boost_failed)(unsigned long gp_state, int *cpup);
383383
int (*stall_dur)(void);
384384
void (*get_gp_data)(int *flags, unsigned long *gp_seq);
385+
void (*gp_slow_register)(atomic_t *rgssp);
386+
void (*gp_slow_unregister)(atomic_t *rgssp);
385387
long cbflood_max;
386388
int irq_capable;
387389
int can_boost;
@@ -570,6 +572,8 @@ static struct rcu_torture_ops rcu_ops = {
570572
.check_boost_failed = rcu_check_boost_fail,
571573
.stall_dur = rcu_jiffies_till_stall_check,
572574
.get_gp_data = rcutorture_get_gp_data,
575+
.gp_slow_register = rcu_gp_slow_register,
576+
.gp_slow_unregister = rcu_gp_slow_unregister,
573577
.irq_capable = 1,
574578
.can_boost = IS_ENABLED(CONFIG_RCU_BOOST),
575579
.extendables = RCUTORTURE_MAX_EXTEND,
@@ -3343,12 +3347,12 @@ rcu_torture_cleanup(void)
33433347
pr_info("%s: Invoking %pS().\n", __func__, cur_ops->cb_barrier);
33443348
cur_ops->cb_barrier();
33453349
}
3346-
rcu_gp_slow_unregister(NULL);
3350+
if (cur_ops->gp_slow_unregister)
3351+
cur_ops->gp_slow_unregister(NULL);
33473352
return;
33483353
}
33493354
if (!cur_ops) {
33503355
torture_cleanup_end();
3351-
rcu_gp_slow_unregister(NULL);
33523356
return;
33533357
}
33543358

@@ -3447,7 +3451,8 @@ rcu_torture_cleanup(void)
34473451
else
34483452
rcu_torture_print_module_parms(cur_ops, "End of test: SUCCESS");
34493453
torture_cleanup_end();
3450-
rcu_gp_slow_unregister(&rcu_fwd_cb_nodelay);
3454+
if (cur_ops->gp_slow_unregister)
3455+
cur_ops->gp_slow_unregister(NULL);
34513456
}
34523457

34533458
#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
@@ -3929,7 +3934,8 @@ rcu_torture_init(void)
39293934
if (object_debug)
39303935
rcu_test_debug_objects();
39313936
torture_init_end();
3932-
rcu_gp_slow_register(&rcu_fwd_cb_nodelay);
3937+
if (cur_ops->gp_slow_register && !WARN_ON_ONCE(!cur_ops->gp_slow_unregister))
3938+
cur_ops->gp_slow_register(&rcu_fwd_cb_nodelay);
39333939
return 0;
39343940

39353941
unwind:

0 commit comments

Comments
 (0)