Re: [PATCH v2 06/13] rcutorture: Add nwriters module parameter
Breno Leitao <[email protected]> Fri, 31 Jul 2026 01:22:19 -0700
| Newsgroups | org.kernel.vger.rcu,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Jul 30, 2026 at 06:07:12PM -0700, Paul E. McKenney wrote: > Believe it or not, there are people who would like to run rcutorture > without actually torturing RCU. For example, some people would like to > induce various types of stall warnings without placing any unnecessary > additional overhead on their systems running in production. And > rcutorture provides the stall_cpu, stall_cpu_holdoff, stall_no_softlockup, > stall_cpu_irqsoff, stall_cpu_block, and stall_cpu_repeat module parameters > in order to allow the user to force numerous types of stalls. In addition, > rcutorture provides a great number of other module parameters to allow the > user to reduce other overhead. > > But unfortunately, there is no way to turn of the rcu_torture_writer() > portion of this torture test, which on my x86 laptop consumes somewhere > between 40% and 45% of a CPU. Although this is quite lightweight for a > torture test, it is not welcome on systems running production workloads. > This commit therefore adds an nwriters module parameter that defaults > to 1 but can be set to 0 in order to disable the rcu_torture_writer() > portion of the torture test, but that cannot be set to any other value > (that is what the fakewriters module parameter is for!). This reduces > the overhead to well under 1% of a CPU, which is much more likely to be > compatible with production workloads. > > Reported-by: Breno Leitao <[email protected]> > Reported-by: Puranjay Mohan <[email protected]> > Reported-by: Usama Arif <[email protected]> > Signed-off-by: Paul E. McKenney <[email protected]> Reviewed-by: Breno Leitao <[email protected]> > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c ... > +torture_param(bool, nwriters, 1, "Number of RCU writer threads (0 or 1)"); It looks like you used `int` for the same parameter in hazptrtorure.c and bool here torture_param(int, nwriters, 1, "Number of hazard-pointer writer threads, 0 or 1"); Needeless to say that bool is more appropriate, and you don't need to check it later. WARN_ON(IS_BUILTIN(CONFIG_HAZPTR_TORTURE_TEST) && nwriters != 1); Thanks for implementing it, --breno