]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
refscale: Correct affinity check
authorPaul E. McKenney <paulmck@kernel.org>
Wed, 9 Oct 2024 18:02:51 +0000 (11:02 -0700)
committerFrederic Weisbecker <frederic@kernel.org>
Tue, 12 Nov 2024 22:04:50 +0000 (23:04 +0100)
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>
Reviewed-by: Neeraj Upadhyay <Neeraj.Upadhyay@amd.com>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
kernel/rcu/refscale.c

index 0db9db73f57f2597cba09b2dca3e81ceac264f95..25910ebe95c0f2fac32ef977cd9737d6f5e61762 100644 (file)
@@ -829,7 +829,7 @@ repeat:
                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))