diff options
-rw-r--r-- | kernel/sched_fair.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 4e777b47eeda..da87385683cc 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -1372,11 +1372,36 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag | |||
1372 | want_sd = 0; | 1372 | want_sd = 0; |
1373 | } | 1373 | } |
1374 | 1374 | ||
1375 | if (want_affine && (tmp->flags & SD_WAKE_AFFINE) && | 1375 | if (want_affine && (tmp->flags & SD_WAKE_AFFINE)) { |
1376 | cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) { | 1376 | int candidate = -1, i; |
1377 | 1377 | ||
1378 | affine_sd = tmp; | 1378 | if (cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) |
1379 | want_affine = 0; | 1379 | candidate = cpu; |
1380 | |||
1381 | /* | ||
1382 | * Check for an idle shared cache. | ||
1383 | */ | ||
1384 | if (tmp->flags & SD_PREFER_SIBLING) { | ||
1385 | if (candidate == cpu) { | ||
1386 | if (!cpu_rq(prev_cpu)->cfs.nr_running) | ||
1387 | candidate = prev_cpu; | ||
1388 | } | ||
1389 | |||
1390 | if (candidate == -1 || candidate == cpu) { | ||
1391 | for_each_cpu(i, sched_domain_span(tmp)) { | ||
1392 | if (!cpu_rq(i)->cfs.nr_running) { | ||
1393 | candidate = i; | ||
1394 | break; | ||
1395 | } | ||
1396 | } | ||
1397 | } | ||
1398 | } | ||
1399 | |||
1400 | if (candidate >= 0) { | ||
1401 | affine_sd = tmp; | ||
1402 | want_affine = 0; | ||
1403 | cpu = candidate; | ||
1404 | } | ||
1380 | } | 1405 | } |
1381 | 1406 | ||
1382 | if (!want_sd && !want_affine) | 1407 | if (!want_sd && !want_affine) |