Received: by 10.213.65.68 with SMTP id h4csp307830imn; Tue, 20 Mar 2018 04:12:23 -0700 (PDT) X-Google-Smtp-Source: AG47ELvVwuttBqTIAuzHidfoMkcPlp1Sgzkug73odSTatfT8F8BwXdK/XJA5OCv7Y35tLMS5ZCfP X-Received: by 2002:a17:902:69ce:: with SMTP id m14-v6mr16452339pln.358.1521544343864; Tue, 20 Mar 2018 04:12:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521544343; cv=none; d=google.com; s=arc-20160816; b=zaRLanMLdWca3rAk0/uLFB/4YRdQSfKkQLnr1GWmlYmXGa4Au0Qs7FxFLwVFR0HwS3 xLUhV7Liv1ISvHSqtvovutYDoscbZxtwMZGKKCi9NwTU6Jrx7oLX/VecQyoJMAQHtd3S cX0P18IQDE/YfQoomugVjd2HPOdlEbeM3NuVvVZh5W57GpFPJwbwAqHc9Nqhe2KKHx6b tuUmXH2idlrBRz3iJpIAf1FzzLygWdu+ToOuQASNESJTeU+G/KGP/3ospqcv/eXRgSoO nLuhL79GyE+ksosY6za1jHlLAWSlxtHwOQvDEQH37f5TWDj47NyPVKLv6b115uUP/k4p TTSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=KbowTVnODijWAfMaJWrlgalKuOGOmk5we3zh13i2SPs=; b=xbjHfxyVsDX21s15ezzLGwlvkeN8tZfKw4+MljjakHoRvFUakTSS1c/lq1w+n1n+vN v0AkgP+Jj8w8ptVTxYKK4OYY7DKRfmSDsY8L0XLfnWtv5j4M+bpxMqYqg5hJ7j7zqQA0 VRzQ3TJgSHIa5nfuh0QePDFuMogw8lXBMfMBEncclgSPoARap0IYp9/YY8fycyM5whIL 0blmO2A74KGQVjbwNLgP6iLoT3zh+CkVZHhmrNh01EJutpX4tTIqxWnxf2rfJ2rK8hnF KFQtM6oIQSm8PoslH9UWxB5uR4/6hk4jVQn+7AIOFbhQciv1buTx9FaDgBydBR+g3pLv edeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c1-v6si1414225pld.401.2018.03.20.04.12.09; Tue, 20 Mar 2018 04:12:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753123AbeCTLJY (ORCPT + 99 others); Tue, 20 Mar 2018 07:09:24 -0400 Received: from terminus.zytor.com ([198.137.202.136]:53075 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752939AbeCTLJV (ORCPT ); Tue, 20 Mar 2018 07:09:21 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTP id w2KB8Vp7012505; Tue, 20 Mar 2018 04:08:31 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w2KB8Vj5012502; Tue, 20 Mar 2018 04:08:31 -0700 Date: Tue, 20 Mar 2018 04:08:31 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Patrick Bellasi Message-ID: Cc: juri.lelli@redhat.com, joelaf@google.com, patrick.bellasi@arm.com, peterz@infradead.org, morten.rasmussen@arm.com, tglx@linutronix.de, tkjos@android.com, torvalds@linux-foundation.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, smuckle@google.com, rafael.j.wysocki@intel.com, mingo@kernel.org, dietmar.eggemann@arm.com, pjt@google.com, viresh.kumar@linaro.org, hpa@zytor.com Reply-To: patrick.bellasi@arm.com, tglx@linutronix.de, morten.rasmussen@arm.com, tkjos@android.com, peterz@infradead.org, juri.lelli@redhat.com, joelaf@google.com, dietmar.eggemann@arm.com, mingo@kernel.org, pjt@google.com, rafael.j.wysocki@intel.com, hpa@zytor.com, viresh.kumar@linaro.org, torvalds@linux-foundation.org, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, smuckle@google.com In-Reply-To: <20180309095245.11071-4-patrick.bellasi@arm.com> References: <20180309095245.11071-4-patrick.bellasi@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/cpufreq/schedutil: Use util_est for OPP selection Git-Commit-ID: a07630b8b2c16f82fd5b71d890079f4dd7599c1d X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: a07630b8b2c16f82fd5b71d890079f4dd7599c1d Gitweb: https://git.kernel.org/tip/a07630b8b2c16f82fd5b71d890079f4dd7599c1d Author: Patrick Bellasi AuthorDate: Fri, 9 Mar 2018 09:52:44 +0000 Committer: Ingo Molnar CommitDate: Tue, 20 Mar 2018 08:11:08 +0100 sched/cpufreq/schedutil: Use util_est for OPP selection When schedutil looks at the CPU utilization, the current PELT value for that CPU is returned straight away. In certain scenarios this can have undesired side effects and delays on frequency selection. For example, since the task utilization is decayed at wakeup time, a long sleeping big task newly enqueued does not add immediately a significant contribution to the target CPU. This introduces some latency before schedutil will be able to detect the best frequency required by that task. Moreover, the PELT signal build-up time is a function of the current frequency, because of the scale invariant load tracking support. Thus, starting from a lower frequency, the utilization build-up time will increase even more and further delays the selection of the actual frequency which better serves the task requirements. In order to reduce these kind of latencies, we integrate the usage of the CPU's estimated utilization in the sugov_get_util function. This allows to properly consider the expected utilization of a CPU which, for example, has just got a big task running after a long sleep period. Ultimately this allows to select the best frequency to run a task right after its wake-up. Signed-off-by: Patrick Bellasi Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Dietmar Eggemann Acked-by: Rafael J. Wysocki Acked-by: Viresh Kumar Cc: Joel Fernandes Cc: Juri Lelli Cc: Linus Torvalds Cc: Morten Rasmussen Cc: Paul Turner Cc: Peter Zijlstra Cc: Steve Muckle Cc: Thomas Gleixner Cc: Todd Kjos Cc: Vincent Guittot Link: http://lkml.kernel.org/r/20180309095245.11071-4-patrick.bellasi@arm.com Signed-off-by: Ingo Molnar --- kernel/sched/sched.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 22909ffc04fb..c3deaee7a7a2 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2163,6 +2163,13 @@ static inline unsigned long cpu_util_dl(struct rq *rq) static inline unsigned long cpu_util_cfs(struct rq *rq) { - return rq->cfs.avg.util_avg; + unsigned long util = READ_ONCE(rq->cfs.avg.util_avg); + + if (sched_feat(UTIL_EST)) { + util = max_t(unsigned long, util, + READ_ONCE(rq->cfs.avg.util_est.enqueued)); + } + + return util; } #endif