aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched_fair.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r--kernel/sched_fair.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index 09d19f77eb3a..eaa00014b499 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1333,10 +1333,25 @@ static int select_task_rq_fair(struct task_struct *p, int flag, int sync)
1333 1333
1334 for_each_domain(cpu, tmp) { 1334 for_each_domain(cpu, tmp) {
1335 /* 1335 /*
1336 * If power savings logic is enabled for a domain, stop there. 1336 * If power savings logic is enabled for a domain, see if we
1337 * are not overloaded, if so, don't balance wider.
1337 */ 1338 */
1338 if (tmp->flags & SD_POWERSAVINGS_BALANCE) 1339 if (tmp->flags & SD_POWERSAVINGS_BALANCE) {
1339 break; 1340 unsigned long power = 0;
1341 unsigned long nr_running = 0;
1342 unsigned long capacity;
1343 int i;
1344
1345 for_each_cpu(i, sched_domain_span(tmp)) {
1346 power += power_of(i);
1347 nr_running += cpu_rq(i)->cfs.nr_running;
1348 }
1349
1350 capacity = DIV_ROUND_CLOSEST(power, SCHED_LOAD_SCALE);
1351
1352 if (nr_running/2 < capacity)
1353 break;
1354 }
1340 1355
1341 switch (flag) { 1356 switch (flag) {
1342 case SD_BALANCE_WAKE: 1357 case SD_BALANCE_WAKE: