Commit 24aca4ae authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

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: default avatarSu Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
Tested-By: default avatarSu Yue <suy.fnst@cn.fujitsu.com>
parent 9e98c678
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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