diff options
| author | Srinath Sridharan <srinathsr@google.com> | 2016-08-02 14:05:46 -0700 |
|---|---|---|
| committer | John Stultz <john.stultz@linaro.org> | 2016-08-11 14:26:51 -0700 |
| commit | c80a9af21aece64d3262900c78bdf39f2fdd6c2e (patch) | |
| tree | 43d441ebd066af98dd5f3f0d342be304380e5bd9 /kernel | |
| parent | b9534b8f0128efdb00865af03106a45ce9d489cb (diff) | |
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
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched/fair.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b84277a8530d..b7b1f2759278 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5651,10 +5651,22 @@ 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 (target_util == 0 || - target_util > new_util) { - target_cpu = i; - target_util = new_util; + 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 || @@ -5666,6 +5678,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; } |
