sched/balancing: Prevent the reselection of a previous env.dst_cpu if some tasks...
authorVladimir Davydov <vdavydov@parallels.com>
Sun, 15 Sep 2013 17:30:13 +0000 (21:30 +0400)
committerIngo Molnar <mingo@kernel.org>
Fri, 20 Sep 2013 10:02:20 +0000 (12:02 +0200)
Currently new_dst_cpu is prevented from being reselected actually, not
dst_cpu. This can result in attempting to pull tasks to this_cpu twice.

Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/281f59b6e596c718dd565ad267fc38f5b8e5c995.1379265590.git.vdavydov@parallels.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/fair.c

index 71c6ef58bbb9d2697dfadc6dd9768c11ab3168ed..0784ab6fcc59d011a621c57f86c99010ec66c59e 100644 (file)
@@ -5261,15 +5261,15 @@ more_balance:
                 */
                if ((env.flags & LBF_DST_PINNED) && env.imbalance > 0) {
 
+                       /* Prevent to re-select dst_cpu via env's cpus */
+                       cpumask_clear_cpu(env.dst_cpu, env.cpus);
+
                        env.dst_rq       = cpu_rq(env.new_dst_cpu);
                        env.dst_cpu      = env.new_dst_cpu;
                        env.flags       &= ~LBF_DST_PINNED;
                        env.loop         = 0;
                        env.loop_break   = sched_nr_migrate_break;
 
-                       /* Prevent to re-select dst_cpu via env's cpus */
-                       cpumask_clear_cpu(env.dst_cpu, env.cpus);
-
                        /*
                         * Go back to "more_balance" rather than "redo" since we
                         * need to continue with same src_cpu.