Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753138AbdLEPYl (ORCPT ); Tue, 5 Dec 2017 10:24:41 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:38300 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753073AbdLEPYa (ORCPT ); Tue, 5 Dec 2017 10:24:30 -0500 X-Google-Smtp-Source: AGs4zMZp6M/d3frZX7PGKJQwIDOQSfhKTpwWvJAUaZczOg6MWvUj/htgsmWHwJFsEMPRAN2HRVGtrw== Date: Tue, 5 Dec 2017 16:24:24 +0100 From: Juri Lelli To: Patrick Bellasi Cc: peterz@infradead.org, mingo@redhat.com, rjw@rjwysocki.net, viresh.kumar@linaro.org, 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, morten.rasmussen@arm.com, dietmar.eggemann@arm.com, alessio.balsini@arm.com, Juri Lelli , Ingo Molnar , "Rafael J . Wysocki" Subject: Re: [RFC PATCH v2 1/8] sched/cpufreq_schedutil: make use of DEADLINE utilization signal Message-ID: <20171205152424.GC15085@localhost.localdomain> References: <20171204102325.5110-1-juri.lelli@redhat.com> <20171204102325.5110-2-juri.lelli@redhat.com> <20171205150935.GL31247@e110439-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171205150935.GL31247@e110439-lin> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2112 Lines: 70 Hi, On 05/12/17 15:09, Patrick Bellasi wrote: > Hi Juri, > [...] > > static void sugov_get_util(unsigned long *util, unsigned long *max, int cpu) > > { > > struct rq *rq = cpu_rq(cpu); > > - unsigned long cfs_max; > > + unsigned long dl_util = (rq->dl.running_bw * SCHED_CAPACITY_SCALE) > > + >> BW_SHIFT; > > What about using a pair of getter methods (e.g. cpu_util_{cfs,dl}) to > be defined in kernel/sched/sched.h? > > This would help to hide class-specific signals mangling from cpufreq. > And here we can have something "more abstract" like: > > unsigned long util_cfs = cpu_util_cfs(rq); > unsigned long util_dl = cpu_util_dl(rq); LGTM. I'll cook something for next spin. > > > > > - cfs_max = arch_scale_cpu_capacity(NULL, cpu); > > + *max = arch_scale_cpu_capacity(NULL, cpu); > > > > - *util = min(rq->cfs.avg.util_avg, cfs_max); > > - *max = cfs_max; > > + /* > > + * 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. > > + */ > > Maybe I don't completely get the above comment, but to me it is not > really required. > > When you say that "util_dl" should be set to a min/guaranteed freq > are you not actually talking about a DL implementation detail? > > From the cpufreq standpoint instead, we should always set a capacity > which can accommodate util_dl + util_cfs. It's more for platforms which supports such combination of values for frequency requests (CPPC like, AFAIU). The idea being that util_dl is what the system has to always guarantee, but it could go up to the sum if feasible. > > We don't care about the meaning of util_dl and we should always assume > (by default) that the signal is properly updated by the scheduling > class... which unfortunately does not always happen for CFS. > > > > + *util = min(rq->cfs.avg.util_avg + dl_util, *max); > > With the above proposal, here also we will have: > > *util = min(util_cfs + util_dl, *max); Looks cleaner. Thanks, - Juri