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

Commit 1117bade authored by Lingutla Chandrasekhar's avatar 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>
[clingutla@codeaurora.org: Resolve trivial merge conflicts]
Signed-off-by: default avatarLingutla Chandrasekhar <clingutla@codeaurora.org>
parent 4719c01d
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -7359,6 +7359,7 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
	unsigned int active_cpus_count = 0;
	int prev_cpu = task_cpu(p);
	bool next_group_higher_cap = false;
	int isolated_candidate = -1;

	*backup_cpu = -1;

@@ -7419,6 +7420,8 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
			if (!cpu_online(i) || cpu_isolated(i))
				continue;

			if (isolated_candidate == -1)
				isolated_candidate = i;
			/*
			 * This CPU is the target of an active migration that's
			 * yet to complete. Avoid placing another task on it.
@@ -7781,6 +7784,11 @@ static inline int find_best_target(struct task_struct *p, int *backup_cpu,
		target_cpu = *backup_cpu;
		*backup_cpu = -1;
	}

	if (target_cpu == -1 && isolated_candidate != -1 &&
	    cpu_isolated(prev_cpu))
		target_cpu == isolated_candidate;

out:
	return target_cpu;
}