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

Commit 08786c13 authored by Srinath Sridharan's avatar Srinath Sridharan Committed by Amit Pundir
Browse files

sched/fair: Picking cpus with low OPPs for tasks that prefer idle CPUs

When idle cpus cannot be found for Top-app/FG tasks, the cpu selection
algorithm picks a cpu with lowest OPP amongst the busy cpus as a second
choice.

Mitigates the "runnable" time for ui and render threads.

bug: 30481949
bug: 30342017
bug: 30508678
Change-Id: I5a97e31d33284895c0fa6f6942102713ee576d77
parent 4d8776f3
Loading
Loading
Loading
Loading
+17 −4
Original line number Diff line number Diff line
@@ -5672,11 +5672,23 @@ static inline int find_best_target(struct task_struct *p, bool prefer_idle)

		if (new_util < cur_capacity) {
			if (cpu_rq(i)->nr_running) {
				if(prefer_idle) {
					// Find a target cpu with lowest
					// utilization.
					if (target_util == 0 ||
						target_util < new_util) {
						target_cpu = i;
						target_util = new_util;
					}
				} else {
					// Find a target cpu with highest
					// utilization.
					if (target_util == 0 ||
						target_util > new_util) {
						target_cpu = i;
						target_util = new_util;
					}
				}
			} else if (!prefer_idle) {
				if (best_idle_cpu < 0 ||
					(sysctl_sched_cstate_aware &&
@@ -5687,6 +5699,7 @@ static inline int find_best_target(struct task_struct *p, bool prefer_idle)
			}
		} else if (backup_capacity == 0 ||
				backup_capacity > cur_capacity) {
			// Find a backup cpu with least capacity.
			backup_capacity = cur_capacity;
			backup_cpu = i;
		}