Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp473709imm; Fri, 28 Sep 2018 01:27:05 -0700 (PDT) X-Google-Smtp-Source: ACcGV60cXbYhDReHBaGDVZxcNozj3QsWXrERvfic5gJF8voftbcSc+4LdMPoeZTK3XnbpVK2l+dI X-Received: by 2002:a63:4745:: with SMTP id w5-v6mr14188974pgk.377.1538123225881; Fri, 28 Sep 2018 01:27:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538123225; cv=none; d=google.com; s=arc-20160816; b=nyi4UwljNe93YBPkXOU/G07ERvxop9wMP9TPsOrloGuTWv1JqGnU7mG8330kWAGo7A XxYqI5nO76foKx9U50AFsQsYPszJm++zAWB2JjfsuoiCB26OTHp99Jco/xpM+cwv2PJf fnmcrB9FyLpnUAh8yIZua1HfYEBf/GXdQWRgGu9DTrm2sSm5/pDudTHtnA9PGWrQyXpT Ejzpadj/imO83I88+C1+YyPJkRhIDybb5gayeyO3ALCg6Oug3KoON+EcqM8rKYnkNEn0 FwmbstYLQSHomNaSk19l6ftIUCKyb6TO32XI3c29AoVSK3v2mCUUiXywC51IiYe21igd 0hxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=kmKIH8sZovyJ36J3fgSBSmKgQO1VfMhpMypOJFo5ALw=; b=m7LP9eZVRpqGmMQXk+1aKfFAJ79VY50oUXsj8i9I58fI5r2mFfTZtGBLafKb/iYn0A /s3/0OBLIwIr31jvnpNAl3Nji4dN2VaoNzfIHz1gHy/EvoVnCdvhguUhynhdSwO3sUfr HQAShqTtD9ndpiayw9HoRvuTm/ZscU+bOTp68CEPSVWo2ZHqmJ5c5s0FKynoUw1aIrGY IfOS+OgU4bGbNhD/9hFQiUFG0YcpuNlBNuuMvlbC75CFYv5/cGNP7n85ue3hNcGqa0/3 h9Df7O9eOmQjMYyzYh+RjBVemORWwrAPPTHvsgRecPgVnhBj8td6fkIoVZJDe2Baod70 ymrA== 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 y3-v6si3953955pgi.338.2018.09.28.01.26.49; Fri, 28 Sep 2018 01:27:05 -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 S1728238AbeI1OtR (ORCPT + 99 others); Fri, 28 Sep 2018 10:49:17 -0400 Received: from cloudserver094114.home.pl ([79.96.170.134]:45206 "EHLO cloudserver094114.home.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726024AbeI1OtR (ORCPT ); Fri, 28 Sep 2018 10:49:17 -0400 Received: from guest-nat.fw1.untrust.par1.mozilla.net (185.155.181.200) (HELO aspire.rjw.lan) by serwer1319399.home.pl (79.96.170.134) with SMTP (IdeaSmtpServer 0.83.148) id 7fb7cbbd1a1f1031; Fri, 28 Sep 2018 10:26:38 +0200 From: "Rafael J. Wysocki" To: Quentin Perret Cc: "Rafael J. Wysocki" , Peter Zijlstra , Linux Kernel Mailing List , Linux PM , Greg Kroah-Hartman , Ingo Molnar , Dietmar Eggemann , Morten Rasmussen , Chris Redpath , Patrick Bellasi , Valentin Schneider , Vincent Guittot , Thara Gopinath , Viresh Kumar , Todd Kjos , Joel Fernandes , Steve Muckle , adharmap@codeaurora.org, Saravana Kannan , Pavan Kondeti , Juri Lelli , Eduardo Valentin , Srinivas Pandruvada , currojerez@riseup.net, Javi Merino Subject: Re: [PATCH v7 02/14] sched/cpufreq: Prepare schedutil for Energy Aware Scheduling Date: Fri, 28 Sep 2018 10:23:42 +0200 Message-ID: <2417577.QmA9JEQx1z@aspire.rjw.lan> In-Reply-To: <20180927121749.urdqtayq6ll4k7qn@queper01-lin> References: <20180912091309.7551-1-quentin.perret@arm.com> <20180927121749.urdqtayq6ll4k7qn@queper01-lin> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thursday, September 27, 2018 2:17:49 PM CEST Quentin Perret wrote: > Hi Rafael, > > Very sorry for the late reply ... > > On Tuesday 18 Sep 2018 at 23:33:22 (+0200), Rafael J. Wysocki wrote: > [...] > > The new "type" argument should be documented. > > > > Also IMO using the special enum for it is quite confusing, because you > > ever only check one value from it directly. What would be wrong with > > using a plain "bool" instead? > > So, this part of the code was originally proposed by Peter. I basically > took it from the following message (hence the Suggested-by) which was > fine by me: > > https://lore.kernel.org/lkml/20180709120138.GQ2494@hirez.programming.kicks-ass.net/ > > Also, one of the things that has been mentioned during reviews was that > other clients (such as cpuidle, IIRC) could potentially be interested > in a 'global' cpu util value. And since those clients might have > different needs than EAS or sugov, they might need a new entry in the > enum. > > So that's probably the main argument for the enum, it is easy to extend. OK, so please document the enum type. > [...] > > > +static unsigned long sugov_get_util(struct sugov_cpu *sg_cpu) > > > +{ > > > + struct rq *rq = cpu_rq(sg_cpu->cpu); > > > + unsigned long util = cpu_util_cfs(rq); > > > + > > > + sg_cpu->max = arch_scale_cpu_capacity(NULL, sg_cpu->cpu); > > > + sg_cpu->bw_dl = cpu_bw_dl(rq); > > > + > > > + return schedutil_freq_util(sg_cpu->cpu, util, FREQUENCY_UTIL); > > > > If you add a "max" argument to schedutil_freq_util(), you can avoid > > the second (and arguably redundant) evaluation of > > arch_scale_cpu_capacity() in there. > > OK > > [...] > > > +enum schedutil_type { > > > + FREQUENCY_UTIL, > > > + ENERGY_UTIL, > > > +}; > > > > As I said above, I would just use "bool" instead of this new enum (it > > has two values too) or the new type needs to be documented. > > As I said above, the enum has the good side of being easier to extend. > So, if we care about that, I guess I'd rather add a doc for the new > type. Right, so please add a kerneldoc description here. > > > + > > > #ifdef CONFIG_CPU_FREQ_GOV_SCHEDUTIL > > > +unsigned long schedutil_freq_util(int cpu, unsigned long util_cfs, > > > + enum schedutil_type type); > > > + > > > static inline unsigned long cpu_bw_dl(struct rq *rq) > > > { > > > return (rq->dl.running_bw * SCHED_CAPACITY_SCALE) >> BW_SHIFT; > > > @@ -2199,6 +2207,12 @@ static inline unsigned long cpu_util_rt(struct rq *rq) > > > { > > > return READ_ONCE(rq->avg_rt.util_avg); > > > } > > > +#else /* CONFIG_CPU_FREQ_GOV_SCHEDUTIL */ > > > +static inline unsigned long schedutil_freq_util(int cpu, unsigned long util, > > > + enum schedutil_type type) > > > +{ > > > + return util; > > > +} > > > #endif > > > > And I would add a wrapper around schedutil_freq_util(), called say > > schedutil_energy_util(), that would pass a specific value as the > > "type". > > OK, that's fine by me. > > Other than that, do you think these changes could be done later ? Or do > you see that as mandatory before the patches can be picked up ? Documenting things properly is absolutely required. The other changes suggested by me are rather straightforward, so why would it be a problem to make them right away if you agree to make them? Thanks, Rafael