From: Paul E. McKenney Date: Wed, 23 Jan 2019 03:23:00 +0000 (-0800) Subject: torture: Don't try to offline the last CPU X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=24aca4aea4f0179e0e56cf9ec610c27d07702945;p=linux.git 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 Signed-off-by: Paul E. McKenney Tested-By: Su Yue --- diff --git a/kernel/torture.c b/kernel/torture.c index 8faa1a9aaeb97..17b2be9bde12a 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