Skip to contentSkip to conversation

sched: reset loop counters if all tasks are pinned and we need to redo load balance

PATCH In review Prashanth Nageshappa 1 participant 3 messages Jun 19, 2012 – Jul 24, 2012 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: reset loop counters if all tasks are pinned and we need to redo load balance

While load balancing, if all tasks on the source runqueue are pinned, we retry after excluding the corresponding source cpu. However, loop counters env.loop and env.loop_break are not reset before retrying, which can lead to failure in moving the tasks. In this patch we reset env.loop and env.loop_break to their inital values before we retry.

---

kernel/sched/fair.c +4 -1
index 939fd63..60f8b66 100644
@@ -4520,8 +4520,11 @@ more_balance:
 		/* All tasks on this runqueue were pinned by CPU affinity */
 		if (unlikely(env.flags & LBF_ALL_PINNED)) {
 			cpumask_clear_cpu(cpu_of(busiest), cpus);
-			if (!cpumask_empty(cpus))
+			if (!cpumask_empty(cpus)) {
+				env.loop = 0;
+				env.loop_break = sched_nr_migrate_break;
 				goto redo;
+			}
 			goto out_balanced;
 		}
 	}
#1 lore raw

[tip:sched/core] sched: Reset loop counters if all tasks are pinned and we need to redo load balance

Commit-ID:  4d44f7090f8233f6994e7397679a32c81187506d
Gitweb:     http://git.kernel.org/tip/4d44f7090f8233f6994e7397679a32c81187506d
Author:     Prashanth Nageshappa <[email protected]>
AuthorDate: Tue, 19 Jun 2012 17:52:07 +0530
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 5 Jul 2012 21:09:10 +0200

sched: Reset loop counters if all tasks are pinned and we need to redo load balance

While load balancing, if all tasks on the source runqueue are pinned, we retry after excluding the corresponding source cpu. However, loop counters env.loop and env.loop_break are not reset before retrying, which can lead to failure in moving the tasks. In this patch we reset env.loop and env.loop_break to their inital values before we retry.

---
 kernel/sched/fair.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
kernel/sched/fair.c +4 -1
index 39b5771..3f94840 100644
@@ -4497,8 +4497,11 @@ more_balance:
 		/* All tasks on this runqueue were pinned by CPU affinity */
 		if (unlikely(env.flags & LBF_ALL_PINNED)) {
 			cpumask_clear_cpu(cpu_of(busiest), cpus);
-			if (!cpumask_empty(cpus))
+			if (!cpumask_empty(cpus)) {
+				env.loop = 0;
+				env.loop_break = sched_nr_migrate_break;
 				goto redo;
+			}
 			goto out_balanced;
 		}
 	}
#2 lore raw

[tip:sched/core] sched: Reset loop counters if all tasks are pinned and we need to redo load balance

In reply to Prashanth Nageshappa
Commit-ID:  bbf18b19495942cc730e8ff11fc3ffadf20cbfe1
Gitweb:     http://git.kernel.org/tip/bbf18b19495942cc730e8ff11fc3ffadf20cbfe1
Author:     Prashanth Nageshappa <[email protected]>
AuthorDate: Tue, 19 Jun 2012 17:52:07 +0530
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 24 Jul 2012 13:55:37 +0200

sched: Reset loop counters if all tasks are pinned and we need to redo load balance

While load balancing, if all tasks on the source runqueue are pinned, we retry after excluding the corresponding source cpu. However, loop counters env.loop and env.loop_break are not reset before retrying, which can lead to failure in moving the tasks. In this patch we reset env.loop and env.loop_break to their inital values before we retry.

---
 kernel/sched/fair.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
kernel/sched/fair.c +4 -1
index 9361669..f9f9aa0 100644
@@ -4288,8 +4288,11 @@ more_balance:
 		/* All tasks on this runqueue were pinned by CPU affinity */
 		if (unlikely(env.flags & LBF_ALL_PINNED)) {
 			cpumask_clear_cpu(cpu_of(busiest), cpus);
-			if (!cpumask_empty(cpus))
+			if (!cpumask_empty(cpus)) {
+				env.loop = 0;
+				env.loop_break = sched_nr_migrate_break;
 				goto redo;
+			}
 			goto out_balanced;
 		}
 	}