diff mbox series

[3/5] refscale: Correct affinity check

Message ID 20241009180253.777965-3-paulmck@kernel.org (mailing list archive)
State Accepted
Commit 246a5cd2bfd381c88cbd7365ac57fd114b67af62
Headers show
Series Torture-test changes for v6.13 | expand

Commit Message

Paul E. McKenney Oct. 9, 2024, 6:02 p.m. UTC
The current affinity check works fine until there are more reader
processes than CPUs, at which point the affinity check is looking for
non-existent CPUs.  This commit therefore applies the same modulus to
the check as is present in the set_cpus_allowed_ptr() call.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
 kernel/rcu/refscale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
index 639d1cfc657b2..af32331ef645a 100644
--- a/kernel/rcu/refscale.c
+++ b/kernel/rcu/refscale.c
@@ -863,7 +863,7 @@  ref_scale_reader(void *arg)
 		goto end;
 
 	// Make sure that the CPU is affinitized appropriately during testing.
-	WARN_ON_ONCE(raw_smp_processor_id() != me);
+	WARN_ON_ONCE(raw_smp_processor_id() != me % nr_cpu_ids);
 
 	WRITE_ONCE(rt->start_reader, 0);
 	if (!atomic_dec_return(&n_started))