summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorPavankumar Kondeti <pkondeti@codeaurora.org>2018-09-14 13:59:59 +0530
committerGeorg Veichtlbauer <georg@vware.at>2023-07-16 12:47:43 +0200
commitdb74739c86de566ca88a8affa96d2d59cfbdbb98 (patch)
treeb333febea35f20594f91c9c2a886af7c4ec09def /kernel
parentaee7a16e347b610fbb50d743c42c21e56cf11211 (diff)
sched: Don't fail isolation request for an already isolated CPU
When isolating a CPU, a check is performed to see if there is only 1 active CPU in the system. If that is the case, the CPU is not isolated. However this check is done before testing if the requested CPU is already isolated or not. If the requested CPU is already isolated, there is no need to fail the isolation even when there is only 1 active CPU in the system. For example, 0-6 CPUs are isolated on a 8 CPU machine. When an isolation request comes for CPU6, which is already isolated, the current code fail the requesting thinking we end up with no active CPU in the system. Change-Id: I28fea4ff67ffed82465e5cfa785414069e4a180a Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/core.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index f73831486c2f..c597f6c61115 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5967,12 +5967,6 @@ int sched_isolate_cpu(int cpu)
cpumask_andnot(&avail_cpus, cpu_online_mask, cpu_isolated_mask);
- /* We cannot isolate ALL cpus in the system */
- if (cpumask_weight(&avail_cpus) == 1) {
- ret_code = -EINVAL;
- goto out;
- }
-
if (!cpu_online(cpu)) {
ret_code = -EINVAL;
goto out;
@@ -5981,6 +5975,13 @@ int sched_isolate_cpu(int cpu)
if (++cpu_isolation_vote[cpu] > 1)
goto out;
+ /* We cannot isolate ALL cpus in the system */
+ if (cpumask_weight(&avail_cpus) == 1) {
+ --cpu_isolation_vote[cpu];
+ ret_code = -EINVAL;
+ goto out;
+ }
+
/*
* There is a race between watchdog being enabled by hotplug and
* core isolation disabling the watchdog. When a CPU is hotplugged in