Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp572790yba; Thu, 16 May 2019 05:45:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqynx/cHRn9tqjDvop/Gylb9HvQaPupDldnByl9k6iXkdL3rfeR0ghsjLNPwZjS9ps5sEmYF X-Received: by 2002:a65:44c7:: with SMTP id g7mr50547457pgs.399.1558010710115; Thu, 16 May 2019 05:45:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558010710; cv=none; d=google.com; s=arc-20160816; b=C/h1aGOvS/8MJw5CAExSwOtR5JT+HbbaL2bJj1iueejPndj3K5NyZsQwIKFpUfPkr2 gYffhOL0+lpHYsr2Yvu901lyY2nfQ7PMHoZD6ouWCMiN79i/tBAvq6vXg/t2nOsmQ8ic ovwNWmQplsjLQHC45yWJCkeHsIB0LCOeH7/zwmrpvCEnZ9AFrlvbrIcg7BebpDYOh2KT ImppRGYVQKJWrM8At3QpCQ5uc9bQACKgoiM+hP+Zj+I8ihigeiM1LTdTMi78VumkB8qB zCzVn6SvdCV7EwqqzKAa+B2Sr4BP1lbdH2MX/+8ieVX88+IfXY6TJpfJdwrqZ/iAlP4U l5KQ== 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=8wD9s9CO5WSajidsS7fxBL2wejhbdshGgWbyWift4jE=; b=TjQzEexoQD0GRJDvwqI2ySI7gMdxhTOgSgc5KqaTA9Sq4qSfPc52pixLtg3lKWHp4s v9TKS2beeg8OYWb+MiWrpKzuW121FVrwHa0JUGX6SkL1zob2Dm7oavCC6PCyqqipw2xG 8Klxm6wg8U+41XDsIyZr2YO1Di8J8oZBO0XNPXTxp4SxKPXISNJtjEFX0v8UbzjwbTHR B+zgVW/uy60GTfY0ZU9RCAL0fwkl0tlL/Q4d91Ha41QXeVTTf9bYhkogjCEmbFAJJaKT 91tO33qNz3DCx3ch3OMW1X1pOxGoX3jBg3sNU6qry3qfbvJUfx2ekRSg2YhsNZqqV+vQ XMLA== 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 q3si4847268pgc.116.2019.05.16.05.44.54; Thu, 16 May 2019 05:45:10 -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 S1727274AbfEPMmI (ORCPT + 99 others); Thu, 16 May 2019 08:42:08 -0400 Received: from foss.arm.com ([217.140.101.70]:44480 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726260AbfEPMmI (ORCPT ); Thu, 16 May 2019 08:42:08 -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 8A5DA80D; Thu, 16 May 2019 05:42:07 -0700 (PDT) Received: from e110439-lin (e110439-lin.cambridge.arm.com [10.1.194.43]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 334D93F703; Thu, 16 May 2019 05:42:06 -0700 (PDT) Date: Thu, 16 May 2019 13:42:00 +0100 From: Patrick Bellasi To: douglas.raillard@arm.com Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, quentin.perret@arm.com, dietmar.eggemann@arm.com Subject: Re: [RFC PATCH 1/7] PM: Introduce em_pd_get_higher_freq() Message-ID: <20190516124200.opxczohjelhvrzmo@e110439-lin> References: <20190508174301.4828-1-douglas.raillard@arm.com> <20190508174301.4828-2-douglas.raillard@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190508174301.4828-2-douglas.raillard@arm.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08-May 18:42, douglas.raillard@arm.com wrote: > From: Douglas RAILLARD > > em_pd_get_higher_freq() returns a frequency greater or equal to the > provided one while taking into account a given cost margin. It also > skips inefficient OPPs that have a higher cost than another one with a > higher frequency. It's worth to add a small description and definition of what we mean by "OPP efficiency". Despite being just an RFC, it could help to better understand what we are after. [...] > +/** + * em_pd_get_higher_freq() - Get the highest frequency that > does not exceed the > + * given cost margin compared to min_freq > + * @pd : performance domain for which this must be done > + * @min_freq : minimum frequency to return > + * @cost_margin : allowed margin compared to min_freq, as a per-1024 value. ^^^^^^^^ here... > + * > + * Return: the chosen frequency, guaranteed to be at least as high as min_freq. > + */ > +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? > + break; > + } > + } > + [...] Best, Patrick -- #include Patrick Bellasi