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

Commit ef13e1ef authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Lingutla Chandrasekhar
Browse files

sched: Avoid placing task on isolated prev_cpu



When best energy efficient cpu is not found, then task gets
placed in its previous cpu, and it could be isolated.
For non-kernel threads, fallback mechanism selects unisolated cpu
which is extra overhead, and also unpinned kernel threads are gets
placed in the previous cpu till the energy efficient cpu found.
Which makes the isolated cpu to wakeup, though the kernel thread
can run on other cpus.

So make sure the fbt returns unisolated cpu, if the task's prev_cpu
is isolated.

Change-Id: Ia13cb08814141d1c08063c1aa9898f7a0101ecd5
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
Signed-off-by: default avatarLingutla Chandrasekhar <clingutla@codeaurora.org>
parent 9cba6936
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -6929,6 +6929,7 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
	int target_cpu = -1;
	int cpu, i;
	unsigned int active_cpus_count = 0;
	int isolated_candidate = -1;

	*backup_cpu = -1;

@@ -6974,13 +6975,16 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
			unsigned long wake_util, new_util, min_capped_util;

			cpumask_clear_cpu(i, &search_cpus);
			if (avoid_prev_cpu && i == task_cpu(p))

			if (!cpu_online(i) || cpu_isolated(i))
				continue;

			if (!cpu_online(i) || cpu_isolated(i) || is_reserved(i))
			isolated_candidate = i;

			if (avoid_prev_cpu && i == task_cpu(p))
				continue;

			if (walt_cpu_high_irqload(i))
			if (walt_cpu_high_irqload(i) || is_reserved(i))
				continue;

			trace_sched_cpu_util(i);
@@ -7266,6 +7270,12 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
		? best_active_cpu
		: best_idle_cpu;

	if (target_cpu == -1 && cpu_isolated(task_cpu(p)) &&
			isolated_candidate != -1) {
		target_cpu = isolated_candidate;
		fbt_env->avoid_prev_cpu = true;
	}

	trace_sched_find_best_target(p, prefer_idle, min_util, cpu,
				     best_idle_cpu, best_active_cpu,
				     target_cpu);