diff options
author | Paul E. McKenney <paulmck@linux.ibm.com> | 2019-01-23 06:23:00 +0300 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.ibm.com> | 2019-03-27 00:42:53 +0300 |
commit | 24aca4aea4f0179e0e56cf9ec610c27d07702945 (patch) | |
tree | 72f765ac677410cbe5cf9fd69a156efb10b34df9 | |
parent | 9e98c678c2d6ae3a17cb2de55d17f69dddaa231b (diff) | |
download | linux-24aca4aea4f0179e0e56cf9ec610c27d07702945.tar.xz |
torture: Don't try to offline the last CPU
If there is only one online CPU, it doesn't make sense to try to offline
it, as any such attempt is guaranteed to fail. This commit therefore
check for this condition and refuses to attempt the nonsensical.
Reported-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Tested-By: Su Yue <suy.fnst@cn.fujitsu.com>
-rw-r--r-- | kernel/torture.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/torture.c b/kernel/torture.c index 8faa1a9aaeb9..17b2be9bde12 100644 --- a/kernel/torture.c +++ b/kernel/torture.c @@ -88,6 +88,8 @@ bool torture_offline(int cpu, long *n_offl_attempts, long *n_offl_successes, if (!cpu_online(cpu) || !cpu_is_hotpluggable(cpu)) return false; + if (num_online_cpus() <= 1) + return false; /* Can't offline the last CPU. */ if (verbose > 1) pr_alert("%s" TORTURE_FLAG |