Message ID | 20250123185828.460836-1-urezki@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/4] rcutorture: Allow a negative value for nfakewriters | expand |
Hello, Paul! > Currently "nfakewriters" parameter can be set to any value but > there is no possibility to adjust it automatically based on how > many CPUs a system has where a test is run on. > > To address this, if the "nfakewriters" is set to negative it will > be adjusted to num_possible_cpus() during torture initialization. > > Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com> > --- > kernel/rcu/rcutorture.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c > index d26fb1d33ed9..6bc161e1e8ac 100644 > --- a/kernel/rcu/rcutorture.c > +++ b/kernel/rcu/rcutorture.c > @@ -4050,6 +4050,10 @@ rcu_torture_init(void) > writer_task); > if (torture_init_error(firsterr)) > goto unwind; > + > + if (nfakewriters < 0) > + nfakewriters = (int) num_possible_cpus(); > + > if (nfakewriters > 0) { > fakewriter_tasks = kcalloc(nfakewriters, > sizeof(fakewriter_tasks[0]), > -- > 2.39.5 > Don't you mind to take this as well? It is needed for: rcu: Update TREE05.boot to test normal synchronize_rcu() -- Uladzislau Rezki
On Tue, Jan 28, 2025 at 09:55:19PM +0100, Uladzislau Rezki wrote: > Hello, Paul! > > > Currently "nfakewriters" parameter can be set to any value but > > there is no possibility to adjust it automatically based on how > > many CPUs a system has where a test is run on. > > > > To address this, if the "nfakewriters" is set to negative it will > > be adjusted to num_possible_cpus() during torture initialization. > > > > Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com> > > --- > > kernel/rcu/rcutorture.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c > > index d26fb1d33ed9..6bc161e1e8ac 100644 > > --- a/kernel/rcu/rcutorture.c > > +++ b/kernel/rcu/rcutorture.c > > @@ -4050,6 +4050,10 @@ rcu_torture_init(void) > > writer_task); > > if (torture_init_error(firsterr)) > > goto unwind; > > + > > + if (nfakewriters < 0) > > + nfakewriters = (int) num_possible_cpus(); > > + > > if (nfakewriters > 0) { > > fakewriter_tasks = kcalloc(nfakewriters, > > sizeof(fakewriter_tasks[0]), > > -- > > 2.39.5 > > > > Don't you mind to take this as well? It is needed for: > > rcu: Update TREE05.boot to test normal synchronize_rcu() I would, but could you please set something up like we have for nreaders (the module parameter) and nrealreaders (the value actually used throughout). I freely admit that nrealfakereaders sounds a bit strange, so please feel free to either embrace the strangeness or propose an alternative. ;-) The reason for this is so that, on a system with 128 CPUs, the user can distinguish between having specified (say) nfakewriters=128 on the one hand or nfakewriters=-1 on the other. Thanx, Paul
diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index d26fb1d33ed9..6bc161e1e8ac 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -4050,6 +4050,10 @@ rcu_torture_init(void) writer_task); if (torture_init_error(firsterr)) goto unwind; + + if (nfakewriters < 0) + nfakewriters = (int) num_possible_cpus(); + if (nfakewriters > 0) { fakewriter_tasks = kcalloc(nfakewriters, sizeof(fakewriter_tasks[0]),
Currently "nfakewriters" parameter can be set to any value but there is no possibility to adjust it automatically based on how many CPUs a system has where a test is run on. To address this, if the "nfakewriters" is set to negative it will be adjusted to num_possible_cpus() during torture initialization. Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com> --- kernel/rcu/rcutorture.c | 4 ++++ 1 file changed, 4 insertions(+)