sched/fair: Honor sync only if CPU is about to goto idle

sync is causing excessive latencies during binder replies as its causing
migration of important tasks to busy CPU. Incase the CPU has a lot of
tasks running, prevent sync from happening

Based on: 3944217bbb

Change-Id: I2077bf11dccc9ae1f68ac1363b06a5d200e385da
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
Signed-off-by: Yaroslav Furman <yaro330@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Zachariah Kennedy 2019-10-14 14:02:22 +00:00 committed by Richard Raya
parent d34e463b5b
commit 4b4d128ca8

View File

@ -8377,6 +8377,7 @@ static int find_energy_efficient_cpu(struct sched_domain *sd,
u64 start_t = 0;
int next_cpu = -1, backup_cpu = -1;
int boosted = (schedtune_task_boost(p) > 0 || per_task_boost(p) > 0);
bool about_to_idle = (cpu_rq(cpu)->nr_running < 2);
fbt_env.fastpath = 0;
fbt_env.need_idle = 0;
@ -8387,7 +8388,7 @@ static int find_energy_efficient_cpu(struct sched_domain *sd,
if (need_idle)
sync = 0;
if (sysctl_sched_sync_hint_enable && sync &&
if (sysctl_sched_sync_hint_enable && sync && about_to_idle &&
bias_to_this_cpu(p, cpu, rtg_target)) {
target_cpu = cpu;
fbt_env.fastpath = SYNC_WAKEUP;