Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3272066imm; Fri, 25 May 2018 02:50:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZor87S1W8eIPM7y88gLorWwNHlJQbOlElMAtPHAjRq4tdZ8R60+OGDEyI+Zj2J5BjJRmGSv X-Received: by 2002:a63:794d:: with SMTP id u74-v6mr1433587pgc.328.1527241813707; Fri, 25 May 2018 02:50:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527241813; cv=none; d=google.com; s=arc-20160816; b=lyWbZg4aI3a6SGEOwVOD3ZBhXvqdCQoSvc/kq3JTCQkZIq6ouXe4Tt13GW890vDH8N xWQlypK66/Syxki2MZ+qBV9uXfg+n/I3SxSovBYs4xuAeMlzhgNkFTNiTV3TfX9xfhq9 C/FCbqkcNSNj03jwhjaVYUMrHQnN6bjockZ8lia08FUbqlUSbgBFTMAYKt8TLrgVko7i GgkWMiyQmNYasTDXGESUWbsUbl/LMpnNbF2CezlLv1lmSlkl2d9PmaRik5i0tltYM4cV RKmcG6Dxm3dH5dqXsHuWc7a0zak0HMFwnXTPaBN3pweoz2t7JZLHVZNLFRMdhzgzLQg6 UaGw== 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=/IueO4oqfgQyDb4gvgZL5WdKUMLaKjYhqctd4/uSPuA=; b=SbxaZgWvxXkBiGisWzv9xoaJNqyZU8YmiNNh9IpBIm7OX+hnb/V3eMPh56LrfUdB2s /BYG+0Yps79imiYaLCSjysjuJJgsAVQo4DPU9jGO/3rFfKsXpZiz3PAZMsHPS3p9c6VD yImi8EdK9oDwDw2NxE6yHPNcgVBaCTTljr++SVASv/LPeUr0KQUeQCs75EtvpNL4DuzZ KQhCoV3sQwYT63+RNlNWggg9dIqPZuYRTmTsmWcZkMa9a0HYQnTDkEN4enNcbQUlfj3n DYhlhQrFU8DhdYhnev9s8enAFTpMXR5BXFgZOIbukBLSCHslr0jIkfA2RiApIQjts88A ps3A== 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 p13-v6si17722602pgv.182.2018.05.25.02.49.58; Fri, 25 May 2018 02:50:13 -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 S965684AbeEYJs0 (ORCPT + 99 others); Fri, 25 May 2018 05:48:26 -0400 Received: from terminus.zytor.com ([198.137.202.136]:39351 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965671AbeEYJsV (ORCPT ); Fri, 25 May 2018 05:48:21 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w4P9lsVD991815 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 25 May 2018 02:47:54 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w4P9lsKA991812; Fri, 25 May 2018 02:47:54 -0700 Date: Fri, 25 May 2018 02:47:54 -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: joelaf@google.com, smuckle@google.com, juri.lelli@redhat.com, viresh.kumar@linaro.org, dietmar.eggemann@arm.com, peterz@infradead.org, rafael.j.wysocki@intel.com, tglx@linutronix.de, vincent.guittot@linaro.org, linux-kernel@vger.kernel.org, patrick.bellasi@arm.com, torvalds@linux-foundation.org, morten.rasmussen@arm.com, hpa@zytor.com, mingo@kernel.org Reply-To: mingo@kernel.org, hpa@zytor.com, torvalds@linux-foundation.org, morten.rasmussen@arm.com, patrick.bellasi@arm.com, linux-kernel@vger.kernel.org, vincent.guittot@linaro.org, tglx@linutronix.de, rafael.j.wysocki@intel.com, peterz@infradead.org, dietmar.eggemann@arm.com, viresh.kumar@linaro.org, smuckle@google.com, juri.lelli@redhat.com, joelaf@google.com In-Reply-To: <20180524141023.13765-2-patrick.bellasi@arm.com> References: <20180524141023.13765-2-patrick.bellasi@arm.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/cpufreq: Modify aggregate utilization to always include blocked FAIR utilization Git-Commit-ID: 8ecf04e11283a28ca88b8b8049ac93c3a99fcd2c 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=0.2 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q autolearn=no 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: 8ecf04e11283a28ca88b8b8049ac93c3a99fcd2c Gitweb: https://git.kernel.org/tip/8ecf04e11283a28ca88b8b8049ac93c3a99fcd2c Author: Patrick Bellasi AuthorDate: Thu, 24 May 2018 15:10:22 +0100 Committer: Ingo Molnar CommitDate: Fri, 25 May 2018 08:04:52 +0200 sched/cpufreq: Modify aggregate utilization to always include blocked FAIR utilization Since the refactoring introduced by: commit 8f111bc357aa ("cpufreq/schedutil: Rewrite CPUFREQ_RT support") we aggregate FAIR utilization only if this class has runnable tasks. This was mainly due to avoid the risk to stay on an high frequency just because of the blocked utilization of a CPU not being properly decayed while the CPU was idle. However, since: commit 31e77c93e432 ("sched/fair: Update blocked load when newly idle") the FAIR blocked utilization is properly decayed also for IDLE CPUs. This allows us to use the FAIR blocked utilization as a safe mechanism to gracefully reduce the frequency only if no FAIR tasks show up on a CPU for a reasonable period of time. Moreover, we also reduce the frequency drops of CPUs running periodic tasks which, depending on the task periodicity and the time required for a frequency switch, was increasing the chances to introduce some undesirable performance variations. Reported-by: Vincent Guittot Tested-by: Vincent Guittot Signed-off-by: Patrick Bellasi Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Thomas Gleixner Acked-by: Viresh Kumar Acked-by: Vincent Guittot Cc: Dietmar Eggemann Cc: Joel Fernandes Cc: Juri Lelli Cc: Linus Torvalds Cc: Morten Rasmussen Cc: Peter Zijlstra Cc: Rafael J . Wysocki Cc: Steve Muckle Link: http://lkml.kernel.org/r/20180524141023.13765-2-patrick.bellasi@arm.com Signed-off-by: Ingo Molnar --- kernel/sched/cpufreq_schedutil.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index e13df951aca7..28592b62b1d5 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -183,22 +183,21 @@ static void sugov_get_util(struct sugov_cpu *sg_cpu) static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) { struct rq *rq = cpu_rq(sg_cpu->cpu); - unsigned long util; - if (rq->rt.rt_nr_running) { - util = sg_cpu->max; - } else { - util = sg_cpu->util_dl; - if (rq->cfs.h_nr_running) - util += sg_cpu->util_cfs; - } + if (rq->rt.rt_nr_running) + return sg_cpu->max; /* + * Utilization required by DEADLINE must always be granted while, for + * FAIR, we use blocked utilization of IDLE CPUs as a mechanism to + * gracefully reduce the frequency when no tasks show up for longer + * periods of time. + * * Ideally we would like to set util_dl as min/guaranteed freq and * util_cfs + util_dl as requested freq. However, cpufreq is not yet * ready for such an interface. So, we only do the latter for now. */ - return min(util, sg_cpu->max); + return min(sg_cpu->max, (sg_cpu->util_dl + sg_cpu->util_cfs)); } static void sugov_set_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, unsigned int flags)