From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752106AbdHHJzf (ORCPT ); Tue, 8 Aug 2017 05:55:35 -0400 Received: from foss.arm.com ([217.140.101.70]:59140 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751868AbdHHJzd (ORCPT ); Tue, 8 Aug 2017 05:55:33 -0400 From: Brendan Jackman To: linux-kernel@vger.kernel.org Cc: Joel Fernandes , Andres Oportus , Dietmar Eggemann , Vincent Guittot , Josef Bacik , Ingo Molnar , Morten Rasmussen , Peter Zijlstra Subject: [PATCH v2] sched/fair: Sync task util before slow-path wakeup Date: Tue, 8 Aug 2017 10:55:19 +0100 Message-Id: <20170808095519.10077-1-brendan.jackman@arm.com> X-Mailer: git-send-email 2.13.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We use task_util in find_idlest_group via capacity_spare_wake. This task_util is updated in wake_cap. However wake_cap is not the only reason for ending up in find_idlest_group - we could have been sent there by wake_wide. So explicitly sync the task util with prev_cpu when we are about to head to find_idlest_group. We could simply do this at the beginning of select_task_rq_fair (i.e. irrespective of whether we're heading to select_idle_sibling or find_idlest_group & co), but I didn't want to slow down the select_idle_sibling path more than necessary. Don't do this during fork balancing, we won't need the task_util and we'd just clobber the last_update_time, which is supposed to be 0. Signed-off-by: Brendan Jackman Cc: Dietmar Eggemann Cc: Vincent Guittot Cc: Josef Bacik Cc: Ingo Molnar Cc: Morten Rasmussen Cc: Peter Zijlstra --- changes v1 -> v2: Just cosmetic kernel/sched/fair.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c95880e216f6..20275178604d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5913,8 +5913,17 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f new_cpu = cpu; } + if (sd && !(sd_flag & SD_BALANCE_FORK)) { + /* + * We're going to need the task's util for capacity_spare_wake + * in find_idlest_group. Sync it up to prev_cpu's + * last_update_time. + */ + sync_entity_load_avg(&p->se); + } + if (!sd) { - pick_cpu: +pick_cpu: if (sd_flag & SD_BALANCE_WAKE) /* XXX always ? */ new_cpu = select_idle_sibling(p, prev_cpu, new_cpu); -- 2.13.0