Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ec35511 authored by Joonwoo Park's avatar Joonwoo Park
Browse files

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: default avatarJoonwoo Park <joonwoop@codeaurora.org>
parent c2e38a43
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -1651,6 +1651,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 */
@@ -1703,7 +1704,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;
		}