Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp503354ybi; Fri, 21 Jun 2019 03:22:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUwMoqEgQo+LyVYx9lsBbUo8EpF9q3wfH9mcAbQ4nQlM5+oqQNNFzRuyBU7Zy1Xv0zGnR+ X-Received: by 2002:a63:f146:: with SMTP id o6mr17225895pgk.179.1561112569504; Fri, 21 Jun 2019 03:22:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561112569; cv=none; d=google.com; s=arc-20160816; b=Kxxp96dWbv7cvyp3Eh80Suue6h+9waIRXNbmrR3e0oTNqz2CURZzIWMJtODUJQhYEF Q8byyE7l0kC/ExQrwrEmrI9n0Y5Okifu2o6H9MlT3HbhO8wLWPGqQpqqhCWhh+aCLi/I M3T2GYFpomSrliIX9fB/6jDNVyTerht7OQP12YiPVyWsvtbquczBADyE058/Bw1Wdvhp 6XxY1nL7ciqbd6INSNvM3Uv9EB04rXcFth+qiHW1mP5HkpkMtPJ7aRzg7M35ZALwb3Hz GHRCSYSIAXuY4KB9GkxN3o5R/Uitw5bVgRCcZZzQ2R0fBS7byrDPZ0HhPKoMsH80U9j7 GifA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=yajZWdABGggph9cZcEufEWsqO13xql9oShxGwnEV0xc=; b=btMRF+nnEND4RHI0SbA2NaRn+rmYgnkz15RIdaB/NcfjZr78HxtvtbdJEcT5+KUaoB EwpSIRNNEgbGmnCg2tjydufWKAt8TXNYUta0jBimOXIyrOVMTd++LqomS1scQJZ9gGjY ICJ+FkQHJcUCpmELNLpzmrPseUy2K1GaiHOI2eO3AtgBaYn2SEsvhs2Nxt7Ayd6vCBl0 fe9shzbqKem5nn1fVvnPzT5vA0zgA99CuxXE0EF3MuCetxHajYYvxr/NgMnd+Dhb+7sD F/xnUh0jt/rVty10AAELnNp8/WRh7MI5l6Bjhdk1o5Wcl/Pfv5qeC622J7ObZcDZt4zr 7jbA== 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 b191si2193873pga.589.2019.06.21.03.22.34; Fri, 21 Jun 2019 03:22:49 -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 S1726385AbfFUKWH (ORCPT + 99 others); Fri, 21 Jun 2019 06:22:07 -0400 Received: from foss.arm.com ([217.140.110.172]:57588 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbfFUKWH (ORCPT ); Fri, 21 Jun 2019 06:22:07 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0AE921478; Fri, 21 Jun 2019 03:22:06 -0700 (PDT) Received: from queper01-lin (queper01-lin.cambridge.arm.com [10.1.195.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 06FF13F718; Fri, 21 Jun 2019 03:22:04 -0700 (PDT) Date: Fri, 21 Jun 2019 11:22:03 +0100 From: Quentin Perret To: Patrick Bellasi Cc: Douglas Raillard , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, dietmar.eggemann@arm.com Subject: Re: [RFC PATCH 1/7] PM: Introduce em_pd_get_higher_freq() Message-ID: <20190621102201.kuid47xl5pi72c4y@queper01-lin> References: <20190508174301.4828-1-douglas.raillard@arm.com> <20190508174301.4828-2-douglas.raillard@arm.com> <20190516124200.opxczohjelhvrzmo@e110439-lin> <20190516130148.uhq55ptut47usnae@queper01-lin> <20190516132250.hedtianse7rnk3wq@e110439-lin> <11976c37-65d3-e0c6-034d-cfec9ebb5b49@arm.com> <20190620130439.c3tk7osezd37pfmj@e110439-lin> <20190621101704.pw7oluum4eqgdgzp@queper01-lin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190621101704.pw7oluum4eqgdgzp@queper01-lin> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Friday 21 Jun 2019 at 11:17:05 (+0100), Quentin Perret wrote: > On Thursday 20 Jun 2019 at 14:04:39 (+0100), Patrick Bellasi wrote: > > On 19-Jun 17:08, Douglas Raillard wrote: > > > Hi Patrick, > > > > > > On 5/16/19 2:22 PM, Patrick Bellasi wrote: > > > > On 16-May 14:01, Quentin Perret wrote: > > > > > On Thursday 16 May 2019 at 13:42:00 (+0100), Patrick Bellasi wrote: > > > > > > > +static inline unsigned long em_pd_get_higher_freq(struct em_perf_domain *pd, > > > > > > > + unsigned long min_freq, unsigned long cost_margin) > > > > > > > +{ > > > > > > > + unsigned long max_cost = 0; > > > > > > > + struct em_cap_state *cs; > > > > > > > + int i; > > > > > > > + > > > > > > > + if (!pd) > > > > > > > + return min_freq; > > > > > > > + > > > > > > > + /* Compute the maximum allowed cost */ > > > > > > > + for (i = 0; i < pd->nr_cap_states; i++) { > > > > > > > + cs = &pd->table[i]; > > > > > > > + if (cs->frequency >= min_freq) { > > > > > > > + max_cost = cs->cost + (cs->cost * cost_margin) / 1024; > > > > > > ^^^^ > > > > > > ... end here we should probably better use SCHED_CAPACITY_SCALE > > > > > > instead of hard-coding in values, isn't it? > > > > > > > > > > I'm not sure to agree. This isn't part of the scheduler per se, and the > > > > > cost thing isn't in units of capacity, but in units of power, so I don't > > > > > think SCHED_CAPACITY_SCALE is correct here. > > > > > > > > Right, I get the units do not match and it would not be elegant to use > > > > it here... > > > > > > > > > But I agree these hard coded values (that one, and the 512 in one of the > > > > > following patches) could use some motivation :-) > > > > > > > > ... ultimately SCHED_CAPACITY_SCALE is just SCHED_FIXEDPOINT_SCALE, > > > > which is adimensional. Perhaps we should use that or yet another alias > > > > for the same. > > > > > > Would it be a good idea to use SCHED_FIXEDPOINT_SCALE in energy.c ? > > > Since it's not part of the scheduler, maybe there is a scale covering a wider scope, > > > or we can introduce a similar ENERGY_FIXEDPOINT_SCALE in energy_model.h. > > > > Well, in energy_model.c we have references to "capacity" and > > "utilization" which are all SCHED_FIXEDPOINT_SCALE range values. > > That symbol is defined in and we already pull > > in other headers. > > > > So, to me it seems it's not unreasonable to say that we use scheduler > > related concepts and it makes more sense than introducing yet another > > scaling factor. > > > > But that's just my two cents ;) > > Perhaps use this ? > > https://elixir.bootlin.com/linux/latest/source/include/linux/energy_model.h#L43 > Nah, bad idea actually ... Sorry for the noise