]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
sched/core: Ensure load_balance() respects the active_mask
authorPeter Zijlstra <peterz@infradead.org>
Mon, 9 Oct 2017 08:36:53 +0000 (10:36 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 10 Oct 2017 08:14:03 +0000 (10:14 +0200)
While load_balance() masks the source CPUs against active_mask, it had
a hole against the destination CPU. Ensure the destination CPU is also
part of the 'domain-mask & active-mask' set.

Reported-by: Levin, Alexander (Sasha Levin) <alexander.levin@verizon.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 77d1dfda0e79 ("sched/topology, cpuset: Avoid spurious/wrong domain rebuilds")
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/fair.c

index ed2ab474ec93566c81f8357ef23237202adb0c52..d3f3094856fe14df9adc8837f569087d5543e7e7 100644 (file)
@@ -8042,6 +8042,13 @@ static int should_we_balance(struct lb_env *env)
        struct sched_group *sg = env->sd->groups;
        int cpu, balance_cpu = -1;
 
+       /*
+        * Ensure the balancing environment is consistent; can happen
+        * when the softirq triggers 'during' hotplug.
+        */
+       if (!cpumask_test_cpu(env->dst_cpu, env->cpus))
+               return 0;
+
        /*
         * In the newly idle case, we will allow all the cpu's
         * to do the newly idle load balance.