From patchwork Tue May 23 08:53:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juri Lelli X-Patchwork-Id: 100359 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp217436qge; Tue, 23 May 2017 01:55:08 -0700 (PDT) X-Received: by 10.84.241.77 with SMTP id u13mr34117294plm.28.1495529708211; Tue, 23 May 2017 01:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495529708; cv=none; d=google.com; s=arc-20160816; b=kgTu7bc/uT8dOPowmrHxQmAmHWCY2HP9tcpVFjFUojpxCnPRzbN8Bdin8b/QjF9LfL HFBzjexqgCk55bDX48rdJWL6cZYA2RAGeyttFRUWgxfPZmm1OUt6s/04f6DadsYl2L21 GKTTgpJN84RCTZjyQPhK57K5nsQLA749V+/FByxSGymDTgMVGc7FhC+vEJosv7vS4b7o NwCCwKjpAcOyakXFD2RP1nPma8An6K/TOq2w9+LujT66GWW1hx5HwLxlmUqjlg22gNlA z4uvUVYDWHEuq/uJ0yib4PNxE9iKvjKP4+uNtHxGo4cvZJh9ZcgQIgimRvXOXqR36rtK xH9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=2H/1Ue2sjwX99zwCvA18E5Q8FF7K/KAaCU+mH4JilZo=; b=e3QLBis7I8MNE7y9BBGg7z/X+C9FQ92botgby5UITeT3oD7ahPNTFh7wsT8b96KYka HiiWbgPmcacJLN1yv0ektKoSl5b59j1BLAOizMhB1/85gm/otpQph2J/I+vEM2I960mC rjVTF7+UGVJwtvieUsY/4z+pl70xQgMnaPuzG9Lcsk5rLNPy13JUdEwNV3LwktHjAZx8 arJsJxVCvJHdKD76Lw59dBLpBXuMq3z58crqRqlOr4SVgIPDhikqv/S9X4CBRA7ZfjmW cBRpJsepzAeGfiEoT95JcCv6qVBcyy4rcBRIp2eXNhZ2b3RfkpOz11BsVGjuRAELZ6Lg uRWQ== 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 84si18207087pfx.319.2017.05.23.01.55.07; Tue, 23 May 2017 01:55:08 -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 S936725AbdEWIy6 (ORCPT + 25 others); Tue, 23 May 2017 04:54:58 -0400 Received: from foss.arm.com ([217.140.101.70]:48170 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967029AbdEWIyw (ORCPT ); Tue, 23 May 2017 04:54:52 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EF535164F; Tue, 23 May 2017 01:54:41 -0700 (PDT) Received: from cam-smtp0.cambridge.arm.com (e106622-lin.cambridge.arm.com [10.1.211.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5479E3F53D; Tue, 23 May 2017 01:54:38 -0700 (PDT) From: Juri Lelli To: peterz@infradead.org, mingo@redhat.com, rjw@rjwysocki.net, viresh.kumar@linaro.org Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, tglx@linutronix.de, vincent.guittot@linaro.org, rostedt@goodmis.org, luca.abeni@santannapisa.it, claudio@evidence.eu.com, tommaso.cucinotta@santannapisa.it, bristot@redhat.com, mathieu.poirier@linaro.org, tkjos@android.com, joelaf@google.com, andresoportus@google.com, morten.rasmussen@arm.com, dietmar.eggemann@arm.com, patrick.bellasi@arm.com, juri.lelli@arm.com, Ingo Molnar , "Rafael J . Wysocki" Subject: [PATCH RFC 4/8] sched/cpufreq_schedutil: split utilization signals Date: Tue, 23 May 2017 09:53:47 +0100 Message-Id: <20170523085351.18586-5-juri.lelli@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170523085351.18586-1-juri.lelli@arm.com> References: <20170523085351.18586-1-juri.lelli@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To be able to treat utilization signals of different scheduling classes in different ways (e.g., CFS signal might be stale while DEADLINE signal is never stale by design) we need to split sugov_cpu::util signal in two: util_cfs and util_dl. This patch does that by also changing sugov_get_util() parameter list. After this change aggregation of the different signals has to be performed by sugov_get_util() users (so that they can decide what to do with the different signals). Suggested-by: Rafael J. Wysocki Signed-off-by: Juri Lelli Cc: Peter Zijlstra Cc: Ingo Molnar Cc: Rafael J. Wysocki Cc: Viresh Kumar Cc: Luca Abeni Cc: Claudio Scordino --- kernel/sched/cpufreq_schedutil.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) -- 2.11.0 diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c index 1508109c7f19..f930cec4c3d4 100644 --- a/kernel/sched/cpufreq_schedutil.c +++ b/kernel/sched/cpufreq_schedutil.c @@ -58,7 +58,8 @@ struct sugov_cpu { u64 last_update; /* The fields below are only needed when sharing a policy. */ - unsigned long util; + unsigned long util_cfs; + unsigned long util_dl; unsigned long max; unsigned int flags; @@ -157,14 +158,13 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy, return cpufreq_driver_resolve_freq(policy, freq); } -static void sugov_get_util(unsigned long *util, unsigned long *max) +static void sugov_get_util(struct sugov_cpu *sg_cpu) { struct rq *rq = this_rq(); - unsigned long dl_util = (rq->dl.running_bw * SCHED_CAPACITY_SCALE) >> 20; - *max = arch_scale_cpu_capacity(NULL, smp_processor_id()); - - *util = min(rq->cfs.avg.util_avg + dl_util, *max); + sg_cpu->max = arch_scale_cpu_capacity(NULL, smp_processor_id()); + sg_cpu->util_cfs = rq->cfs.avg.util_avg; + sg_cpu->util_dl = (rq->dl.running_bw * SCHED_CAPACITY_SCALE) >> 20; } static void sugov_set_iowait_boost(struct sugov_cpu *sg_cpu, u64 time, @@ -231,7 +231,9 @@ static void sugov_update_single(struct update_util_data *hook, u64 time, if (flags & SCHED_CPUFREQ_RT) { next_f = policy->cpuinfo.max_freq; } else { - sugov_get_util(&util, &max); + sugov_get_util(sg_cpu); + max = sg_cpu->max; + util = min(sg_cpu->util_cfs + sg_cpu->util_dl, max); sugov_iowait_boost(sg_cpu, &util, &max); next_f = get_next_freq(sg_policy, util, max); /* @@ -271,8 +273,8 @@ static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, u64 time) if (j_sg_cpu->flags & SCHED_CPUFREQ_RT) return policy->cpuinfo.max_freq; - j_util = j_sg_cpu->util; j_max = j_sg_cpu->max; + j_util = min(j_sg_cpu->util_cfs + j_sg_cpu->util_dl, j_max); if (j_util * max > j_max * util) { util = j_util; max = j_max; @@ -289,15 +291,12 @@ static void sugov_update_shared(struct update_util_data *hook, u64 time, { struct sugov_cpu *sg_cpu = container_of(hook, struct sugov_cpu, update_util); struct sugov_policy *sg_policy = sg_cpu->sg_policy; - unsigned long util, max; unsigned int next_f; - sugov_get_util(&util, &max); raw_spin_lock(&sg_policy->update_lock); - sg_cpu->util = util; - sg_cpu->max = max; + sugov_get_util(sg_cpu); sg_cpu->flags = flags; sugov_set_iowait_boost(sg_cpu, time, flags);