summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorJoonwoo Park <joonwoop@codeaurora.org>2015-10-20 18:21:35 -0700
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 20:02:36 -0700
commit0254e508432c631a00905a13fc5490067646d406 (patch)
treeae3ef34c7246624a2dc801f06bbfdd8f05b5cfa8 /kernel
parentdba1a27b5a1e585a5292a150926b39137035deff (diff)
sched: add preference for prev and sibling CPU in RT task placement
Add a bias towards the RT task's previous CPU and sibling CPUs in order to avoid cache bouncing and migrations. CRs-fixed: 927903 Change-Id: I45d79d774e65efcb38282130b6692b4c3b03c2f0 Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/rt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 82b4052b621b..f0f3cf71c538 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1667,6 +1667,7 @@ static int find_lowest_rq_hmp(struct task_struct *task)
int cpu_cost, min_cost = INT_MAX;
u64 cpu_load, min_load = ULLONG_MAX;
int best_cpu = -1;
+ int prev_cpu = task_cpu(task);
int i;
/* Make sure the mask is initialized first */
@@ -1709,7 +1710,10 @@ static int find_lowest_rq_hmp(struct task_struct *task)
if (sched_cpu_high_irqload(i))
continue;
- if (cpu_load < min_load) {
+ if (cpu_load < min_load ||
+ (cpu_load == min_load &&
+ (i == prev_cpu || (best_cpu != prev_cpu &&
+ cpus_share_cache(prev_cpu, i))))) {
min_load = cpu_load;
best_cpu = i;
}