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

Commit d05c5eb2 authored by Steve Muckle's avatar Steve Muckle Committed by Gerrit - the friendly Code Review server
Browse files

sched: run sync wakeup small tasks on current CPU when possible



During a sync wakeup of a small task, if the waker CPU has only
the waker task running, run the waking task on that same CPU.
Cache hotness may outweigh considerations of CPU differences in
this scenario.

Change-Id: I5df9bafd29424ccecb98abe63eeec0458be9e175
Signed-off-by: default avatarSteve Muckle <smuckle@codeaurora.org>
parent 567e2ecb
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1715,12 +1715,21 @@ static int best_small_task_cpu(struct task_struct *p, int sync)
	u64 load;
	int cost_list[nr_cpu_ids];
	struct cpumask search_cpus;
	int cpu = smp_processor_id();

	cpumask_and(&search_cpus,  tsk_cpus_allowed(p), cpu_online_mask);

	if (cpumask_empty(&search_cpus))
		return task_cpu(p);

	/*
	 * If a CPU is doing a sync wakeup and it only has one currently
	 * running task, just run the waking small task on that CPU regardless
	 * of what type of CPU it is.
	 */
	if (sync && cpu_rq(cpu)->nr_running == 1)
		return cpu;

	/* Take a first pass to find the lowest power cost CPU. This
	   will avoid a potential O(n^2) search */
	for_each_cpu(i, &search_cpus) {