rcutorture: Create nocb tasks only for CONFIG_RCU_NOCB_CPU=y kernels
Subsystems (2)
PATCH v3 1/1 rcutorture: Create nocb tasks only for CONFIG_RCU_NOCB_CPU=y kernels
When setting nocbs_nthreads to start rcutorture test with a non-zero value, the nocb tasks will be created and invoke rcu_nocb_cpu_offload/deoffload() to toggle CPU's callback-offload state, but for CONFIG_RCU_NOCB_CPU=n kernel, the rcu_nocb_cpu_offload/deoffload() is a no-op and this is also meaningless for torture_type is non-rcu.
This commit therefore add member can_nocbs_toggle to rcu_torture_ops structure to avoid unnecessary nocb tasks creation.
--- kernel/rcu/rcutorture.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/rcu/rcutorture.c +6 -0
@@ -3708,6 +3708,12 @@ rcu_torture_init(void)pr_alert ("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n" ); fqs_duration =0 ; } +if (nocbs_nthreads !=0 && (cur_ops != &rcu_ops || + !IS_ENABLED (CONFIG_RCU_NOCB_CPU ))) { +pr_alert ("rcu-torture types: %s and CONFIG_RCU_NOCB_CPU=%d, nocb toggle disabled.\n" , + cur_ops->name,IS_ENABLED (CONFIG_RCU_NOCB_CPU )); + nocbs_nthreads =0 ; + }if (cur_ops->init) cur_ops->init ();
Signature · 1 line
2.25.1
Quoted 8 lines
When setting
nocbs_nthreadsto start rcutorture test with a non-zero value, the nocb tasks will be created and invoke rcu_nocb_cpu_offload/deoffload() to toggle CPU's callback-offload state, but forCONFIG_RCU_NOCB_CPU=nkernel, the rcu_nocb_cpu_offload/deoffload() is a no-op and this is also meaningless fortorture_typeis non-rcu.This commit therefore add member
can_nocbs_toggletorcu_torture_opsstructure to avoid unnecessary nocb tasks creation.
Will change commit log next version.
Thanks
Zqiang
Quoted 25 lines
Signed-off-by Zqiang <[email protected]>---
kernel/rcu/rcutorture.c| 6 ++++++1 file changed, 6 insertions(+)kernel/rcu/rcutorture.c +6
-0@@ -3708,6 +3708,12 @@ rcu_torture_init(void)pr_alert ("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n" ); fqs_duration =0 ; } +if (nocbs_nthreads !=0 && (cur_ops != &rcu_ops || + !IS_ENABLED (CONFIG_RCU_NOCB_CPU ))) { +pr_alert ("rcu-torture types: %s and CONFIG_RCU_NOCB_CPU=%d, nocb toggle disabled.\n" , + cur_ops->name,IS_ENABLED (CONFIG_RCU_NOCB_CPU )); + nocbs_nthreads =0 ; + }if (cur_ops->init) cur_ops->init ();Signature · 1 line
2.25.1
Quoted 11 lines · Zqiang
When setting
nocbs_nthreadsto start rcutorture test with a non-zero value, the nocb tasks will be created and invoke rcu_nocb_cpu_offload/deoffload() to toggle CPU's callback-offload state, but forCONFIG_RCU_NOCB_CPU=nkernel, the rcu_nocb_cpu_offload/deoffload() is a no-op and this is also meaningless fortorture_typeis non-rcu.This commit therefore add member
can_nocbs_toggletorcu_torture_opsstructure to avoid unnecessary nocb tasks creation.Signed-off-by Zqiang <[email protected]>
thanks,
- Joel
Quoted 24 lines
--- kernel/rcu/rcutorture.c | 6 ++++++ 1 file changed, 6 insertions(+)kernel/rcu/rcutorture.c +6
-1@@ -3708,6 +3708,12 @@ rcu_torture_init(void)pr_alert ("rcu-torture: ->fqs NULL and non-zero fqs_duration, fqs disabled.\n" ); fqs_duration =0 ; } +if (nocbs_nthreads !=0 && (cur_ops != &rcu_ops || + !IS_ENABLED (CONFIG_RCU_NOCB_CPU ))) { +pr_alert ("rcu-torture types: %s and CONFIG_RCU_NOCB_CPU=%d, nocb toggle disabled.\n" , + cur_ops->name,IS_ENABLED (CONFIG_RCU_NOCB_CPU )); + nocbs_nthreads =0 ; + }if (cur_ops->init) cur_ops->init (); --2.25.1