]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
rcutorture: Traverse possible cpu to set maxcpu in rcu_nocb_toggle()
authorZqiang <qiang.zhang1211@gmail.com>
Thu, 24 Aug 2023 08:42:06 +0000 (16:42 +0800)
committerFrederic Weisbecker <frederic@kernel.org>
Sun, 24 Sep 2023 15:24:02 +0000 (17:24 +0200)
Currently, the maxcpu is set by traversing online CPUs, however, if the
rcutorture.onoff_holdoff is set zero and onoff_interval is set non-zero,
and the some CPUs with larger cpuid has been offline before setting
maxcpu, for these CPUs, even if they are online again, also cannot
be offload or deoffload.  This can result in rcutorture attempting to
(de-)offload CPUs that have never been online, but the (de-)offload code
handles this.

This commit therefore use for_each_possible_cpu() instead of
for_each_online_cpu() in rcu_nocb_toggle().

Signed-off-by: Zqiang <qiang.zhang1211@gmail.com>
Reviewed-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
kernel/rcu/rcutorture.c

index 8136fec0310b5c9bb97c58a713e5e5e98988316f..b17ad45cd67ed42a8bd15d5776197f786a5b7449 100644 (file)
@@ -2126,7 +2126,7 @@ static int rcu_nocb_toggle(void *arg)
        VERBOSE_TOROUT_STRING("rcu_nocb_toggle task started");
        while (!rcu_inkernel_boot_has_ended())
                schedule_timeout_interruptible(HZ / 10);
-       for_each_online_cpu(cpu)
+       for_each_possible_cpu(cpu)
                maxcpu = cpu;
        WARN_ON(maxcpu < 0);
        if (toggle_interval > ULONG_MAX)