rcutorture: Create nocb kthreads only when testing rcu in CONFIG_RCU_NOCB_CPU=y kernels
authorZqiang <qiang1.zhang@intel.com>
Fri, 3 Feb 2023 06:40:54 +0000 (14:40 +0800)
committerBoqun Feng <boqun.feng@gmail.com>
Mon, 20 Mar 2023 18:11:44 +0000 (11:11 -0700)
commit4f02ac237813a31d4fcb4c9eb9b699b15956b53b
treeb915594fcc0ab68382ccaa3209fd250d3a54735d
parent877a0e83c57fa5e2a7fd628ec2e1733ed70c8792
rcutorture: Create nocb kthreads only when testing rcu in CONFIG_RCU_NOCB_CPU=y kernels

Given a non-zero rcutorture.nocbs_nthreads module parameter, the specified
number of nocb kthreads will be created, regardless of whether or not
the RCU implementation under test is capable of offloading callbacks.
Please note that even vanilla RCU is incapable of offloading in kernels
built with CONFIG_RCU_NOCB_CPU=n.  And when the RCU implementation is
incapable of offloading callbacks, there is no point in creating those
kthreads.

This commit therefore checks the cur_ops.torture_type module parameter and
CONFIG_RCU_NOCB_CPU Kconfig option in order to avoid creating unnecessary
nocb tasks.

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
[ boqun: Fix checkpatch warning ]
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
kernel/rcu/rcutorture.c