From db00ec15cbbaba8a6ea10a0ff6bd05bd8d61b362 Mon Sep 17 00:00:00 2001 From: Chris Redpath Date: Wed, 8 Mar 2017 13:37:32 +0000 Subject: [PATCH] ANDROID: sched/fair: ensure utilization signals are synchronized before use wake_cap performs task and cpu utilization synchronization which is what allows us to subtract current task util from prev_cpu util and have a sensible number to work with. It looks as though if wake_wide returns 0, we could potentially not execute wake_cap, which would result in unsynced signals we then use for energy calculations. This is not necessarily an issue we've seen in traces, but it looks as though it should be changed. Change-Id: Ic54a3cba2a10d946ea20113a04371dea04115e82 Signed-off-by: Chris Redpath [Remove _wake_cap variable to match commit cf6ed9a6682d3f171cf9550d4bbe0ef31b768a7e] Signed-off-by: Quentin Perret --- kernel/sched/fair.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index fd0e55fee9a3..0d453e9c6ea2 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6762,8 +6762,13 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f if (sd_flag & SD_BALANCE_WAKE) { record_wakee(p); - want_affine = (!wake_wide(p) && !wake_cap(p, cpu, prev_cpu) && - cpumask_test_cpu(cpu, tsk_cpus_allowed(p))); + /* + * do wake_cap unconditionally as it causes task and cpu + * utilization to be synced, and we need that for energy + * aware wakeups + */ + want_affine = !wake_wide(p) && !wake_cap(p, cpu, prev_cpu) + && cpumask_test_cpu(cpu, tsk_cpus_allowed(p)); } if (energy_aware() && !(cpu_rq(prev_cpu)->rd->overutilized))