Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1761192imm; Sun, 15 Jul 2018 16:29:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf5vBNjK2sboB5/xiei62KAqFn70qw6FjKROxE/IYyLQZHc+pdLgAlpn/dZPgZZzi8uBQ2R X-Received: by 2002:a65:5683:: with SMTP id v3-v6mr13250940pgs.176.1531697374048; Sun, 15 Jul 2018 16:29:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531697374; cv=none; d=google.com; s=arc-20160816; b=KpbK+ns3i4ZSl10A6ViNhRq8CmUSf/AXGd9TxxH42yVdnWW3EqPnONDNq2KpkHknKH QQpDtBAIsEOboAkJ3X1OfkygI2oOMFvC++ZcBqmE3XVuXnjj7MAK5hilL6lkYWwSaw4s ylo9trjCYeSvFvxBVg2vYdtb4RKV/6RmIlzV+ddVAdFcW6/Fn4RVyd/eDa51ygWEc3Qm wgGDfvZfpbTC82tt1IH5QLY2Qpxvt38uks9nOXUufsa1SVu4OPJ/qR2HkfJwqLT7ko4P X0YfACsGdXLu8c4WVJxtiJWTARtpjEBYKq9d8cyjkKSGGqKJK9AnOq71XqRILNjSsOUx 6w5Q== 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=BKmNRq8ofZ7ZgaYlmq/UKloqg11Uc+q7jAgR5okOo3M=; b=jvIH2CWWLsT9Ay040ZYG7mebcRmTz2rrBC9YyHFMmRPfd0pzkfZ7/0QNYYb2mndj/N HIUqxsf8lanu4rccM+z6LhTqw/jxnBSaqk8BCnpGdk+pExVmGcUgV/eGpPzDEdowsAmd FETb4MJVwx073cxTlrsorEiDlAvo991hH37PzGizL9KNE3y6NY12UnJJAOdDORG9WaeC oY8y5ekGMoNyi+zFUvI8tGlEj7ynQjO3rfUZcJhEWvXWbEC24G0Mgf6FAlWPPXg/Wd24 PvKyTjAmBVBchlgD3LD85c58seLclsRvJF89movCMXuE6ChHeRfwnj7R2ejbaWpZtHmD bT8A== 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 z77-v6si31331824pff.100.2018.07.15.16.29.19; Sun, 15 Jul 2018 16:29:34 -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 S1728147AbeGOXw2 (ORCPT + 99 others); Sun, 15 Jul 2018 19:52:28 -0400 Received: from terminus.zytor.com ([198.137.202.136]:32959 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727203AbeGOXw2 (ORCPT ); Sun, 15 Jul 2018 19:52:28 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w6FNRXUA921307 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 15 Jul 2018 16:27:33 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w6FNRXPL921304; Sun, 15 Jul 2018 16:27:33 -0700 Date: Sun, 15 Jul 2018 16:27:33 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Vincent Guittot Message-ID: Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, mingo@kernel.org, viresh.kumar@linaro.org, tglx@linutronix.de, vincent.guittot@linaro.org, hpa@zytor.com, peterz@infradead.org Reply-To: torvalds@linux-foundation.org, mingo@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, peterz@infradead.org, tglx@linutronix.de, vincent.guittot@linaro.org, viresh.kumar@linaro.org In-Reply-To: <1530200714-4504-4-git-send-email-vincent.guittot@linaro.org> References: <1530200714-4504-4-git-send-email-vincent.guittot@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] cpufreq/schedutil: Use RT utilization tracking Git-Commit-ID: 3ae117c6cd7c4783819a0766aa97b9493a8a0f62 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, T_DATE_IN_FUTURE_96_Q 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: 3ae117c6cd7c4783819a0766aa97b9493a8a0f62 Gitweb: https://git.kernel.org/tip/3ae117c6cd7c4783819a0766aa97b9493a8a0f62 Author: Vincent Guittot AuthorDate: Thu, 28 Jun 2018 17:45:06 +0200 Committer: Ingo Molnar CommitDate: Sun, 15 Jul 2018 23:51:20 +0200 cpufreq/schedutil: Use RT utilization tracking Add both CFS and RT utilization when selecting an OPP for CFS tasks as RT can preempt and steal CFS's running time. RT util_avg is used to take into account the utilization of RT tasks on the CPU when selecting OPP. If a RT task migrate, the RT utilization will not migrate but will decay over time. On an overloaded CPU, CFS utilization reflects the remaining utilization avialable on CPU. When RT task migrates, the CFS utilization will increase when tasks will start to use the newly available capacity. At the same pace, RT utilization will decay and both variations will compensate each other to keep unchanged overall utilization and will prevent any OPP drop. Signed-off-by: Vincent Guittot Signed-off-by: Peter Zijlstra (Intel) Acked-by: Viresh Kumar Cc: Linus Torvalds Cc: Morten.Rasmussen@arm.com Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: claudio@evidence.eu.com Cc: daniel.lezcano@linaro.org Cc: dietmar.eggemann@arm.com Cc: joel@joelfernandes.org Cc: juri.lelli@redhat.com Cc: luca.abeni@santannapisa.it Cc: patrick.bellasi@arm.com Cc: quentin.perret@arm.com Cc: rjw@rjwysocki.net Cc: valentin.schneider@arm.com Link: http://lkml.kernel.org/r/1530200714-4504-4-git-send-email-vincent.guittot@linaro.org Signed-off-by: Ingo Molnar --- kernel/sched/cpufreq_schedutil.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index c907fde01eaa..da29b5a33adb 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -56,6 +56,7 @@ struct sugov_cpu { /* The fields below are only needed when sharing a policy: */ unsigned long util_cfs; unsigned long util_dl; + unsigned long util_rt; unsigned long max; /* The field below is for single-CPU policies only: */ @@ -186,15 +187,21 @@ static void sugov_get_util(struct sugov_cpu *sg_cpu) sg_cpu->max = arch_scale_cpu_capacity(NULL, sg_cpu->cpu); sg_cpu->util_cfs = cpu_util_cfs(rq); sg_cpu->util_dl = cpu_util_dl(rq); + sg_cpu->util_rt = cpu_util_rt(rq); } static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) { struct rq *rq = cpu_rq(sg_cpu->cpu); + unsigned long util; if (rt_rq_is_runnable(&rq->rt)) return sg_cpu->max; + util = sg_cpu->util_dl; + util += sg_cpu->util_cfs; + util += sg_cpu->util_rt; + /* * Utilization required by DEADLINE must always be granted while, for * FAIR, we use blocked utilization of IDLE CPUs as a mechanism to @@ -205,7 +212,7 @@ static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu) * 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(sg_cpu->max, (sg_cpu->util_dl + sg_cpu->util_cfs)); + return min(sg_cpu->max, util); } /**