Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp513063rdh; Thu, 26 Oct 2023 08:14:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHFhTV47pIe5fENLWLJvv28H6rNhvEvrPgZChdcFEzBkhhLx/MbFlevJDtspamiW6LS2KVv X-Received: by 2002:a05:6808:21aa:b0:3a9:9ce5:83a9 with SMTP id be42-20020a05680821aa00b003a99ce583a9mr25315715oib.50.1698333269048; Thu, 26 Oct 2023 08:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698333269; cv=none; d=google.com; s=arc-20160816; b=plHPNjXR/kkP8Gxsxj6OSuNSeTFwBmUlE35re7w41vXTBw9geN+FRui/14kcg4xRUE 2eaGAaP2ovNhFLts09xvDp6+tOIqzCoIWWoLezD9eOxjhjlNR4JGhws2y9yPwty4tPLS xCElwWfEYTwdtSQwcmHkmaUCT5opkwFES2Q4fmJOWkQ6rvYfeJ91Ut1tL8bMJUlARFSf x3OpaT1l9ls9lf9anvar+itU5Fd7tnCpN77XEd4aFxZ63ncda8Q3K9u+e04jZyEM2cGY bBFCYFljfHkhyFQR6MnCtnIWkgJHM4UB7aYVcSknUsCaqEdwGfFf31qGEAHmdNIEy+S3 hmpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sIQNokBhQSScd068h2R0va+GxK2e4ptgRXBIV8yGO3Q=; fh=WhMzjBAC1xnlVoXL93JctsIDejC3rBWXj/xzZDDReDg=; b=bTND0GLgWsQzJZC51w09yPLdwmIY6qXgp8VhZMos+r0sVJ5/r7MnP9veFz5T8NpPem S+EYZamZ0jKSAbcOqcoxGf2qXwIYR4/5zQM+5txX3AhQyJDfTv9mXn36WPmb+5AxstEh DTlnXa6PLrsC1O2BYC9f2o3/EpZm68xEUOl2x9dTELC8NPiS8P5JfqTn+w6z3R54ak3q wSZK46DG29eKT9I0ApBVJ4kJNdplI4JUk6tYdecwAxJabq28/yZMWu6XIlEYNvYw148K V2D4J/nZy5H7OFdhBZXgu/WAGTGPCLbFB9vHwwUdEEuTkSyVSodvh4Cxpko6zBoeqZxn 2YtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N62rOjti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id k84-20020a252457000000b00d9a681e563esi13808942ybk.244.2023.10.26.08.14.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 08:14:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N62rOjti; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B8D7581906AB; Thu, 26 Oct 2023 08:14:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231540AbjJZPNr (ORCPT + 99 others); Thu, 26 Oct 2023 11:13:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231347AbjJZPNq (ORCPT ); Thu, 26 Oct 2023 11:13:46 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8D7718A for ; Thu, 26 Oct 2023 08:13:43 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-5b8ece0f440so754056a12.1 for ; Thu, 26 Oct 2023 08:13:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698333223; x=1698938023; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=sIQNokBhQSScd068h2R0va+GxK2e4ptgRXBIV8yGO3Q=; b=N62rOjtivORs1dnaKyFdptn0As3ebL4e2NRp4MbtpxB9NhDjEp5XfFLDjW5wu9AikT v4ZEReFBnrUJnqqwDpG6EOTYtHxx3iZSge7qELAO4/Uvt/M6tPB0cCuQbRw4HPvQs8dz 6dB9UpZt+wWSe+JfhagQGXCePRB8a/pULdL186CltT7SodHSkcsiYi5/QYd91htniKuv 18HUO0QyHm44ye30s416GpgwfRB2jxi5uXQVNrVLSaHOqkGWlWTYooI31FEONHkgzsGa LRsXBkfmhFTolbfVbWPiSK+V2+oO2gTNsOQhVy5PS+HCBt44Bxii7dpGrdCRJiAbOlhs gUBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698333223; x=1698938023; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sIQNokBhQSScd068h2R0va+GxK2e4ptgRXBIV8yGO3Q=; b=DPBxdSFGLNJsZZZJtCxDO0eBShX+DP+QUjijNiXjOc8v4kRsWzxLfDB4bMDsFpx2/M xjpcVOoIUre6IK5OutRolikEWzjEB2mVkiTtbMjsY3x17akrHATu32QpJIoP7+MLnM9Y g6nRbYNUrMTLMIPcEBfugSfVUHysqoKlbor3n3QsjqdCUc8IpnIL8hAL9KTNi9Vr/g1w M4KZvT5WDKhymxDw86wskKMKpqLAWD1nrCbXE6n8bvSdNMkWIj0XyqLC+th4p7h5Dzlm l94XLkWrj2AkA39RvwfjcbaPUDLo4bSprYb4PuepVFuxgvgm3wKSrsIDupHiAIUjSXIw T12Q== X-Gm-Message-State: AOJu0Yy3YK6yt/2m3HJd492YOKzAlMB+esgCHaGPD9Y5GNMoHUmFAvrd h8dUVwc6ZJK+EA/PHNnj54E9QkyldvydURFaySITbw== X-Received: by 2002:a17:90a:1a43:b0:27d:12e1:94e0 with SMTP id 3-20020a17090a1a4300b0027d12e194e0mr12590526pjl.36.1698333223116; Thu, 26 Oct 2023 08:13:43 -0700 (PDT) MIME-Version: 1.0 References: <20231018162540.667646-1-vincent.guittot@linaro.org> <20231018162540.667646-4-vincent.guittot@linaro.org> In-Reply-To: From: Vincent Guittot Date: Thu, 26 Oct 2023 17:13:31 +0200 Message-ID: Subject: Re: [PATCH v3 3/6] cpufreq/schedutil: use a fixed reference frequency To: Dietmar Eggemann Cc: linux@armlinux.org.uk, catalin.marinas@arm.com, will@kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, sudeep.holla@arm.com, gregkh@linuxfoundation.org, rafael@kernel.org, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, viresh.kumar@linaro.org, lenb@kernel.org, robert.moore@intel.com, lukasz.luba@arm.com, ionela.voinescu@arm.com, pierre.gondois@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linuxfoundation.org, conor.dooley@microchip.com, suagrfillet@gmail.com, ajones@ventanamicro.com, lftan@kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Thu, 26 Oct 2023 08:14:20 -0700 (PDT) On Wed, 25 Oct 2023 at 22:13, Dietmar Eggemann wrote: > > On 18/10/2023 18:25, Vincent Guittot wrote: > > cpuinfo.max_freq can change at runtime because of boost as an example. This > > implies that the value could be different than the one that has been > > used when computing the capacity of a CPU. > > > > The new arch_scale_freq_ref() returns a fixed and coherent reference > > frequency that can be used when computing a frequency based on utilization. > > > > Use this arch_scale_freq_ref() when available and fallback to > > policy otherwise. > > > > Signed-off-by: Vincent Guittot > > Reviewed-by: Lukasz Luba > > Tested-by: Lukasz Luba > > > > --- > > kernel/sched/cpufreq_schedutil.c | 26 ++++++++++++++++++++++++-- > > 1 file changed, 24 insertions(+), 2 deletions(-) > > > > diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c > > index 458d359f5991..6e4030482ae8 100644 > > --- a/kernel/sched/cpufreq_schedutil.c > > +++ b/kernel/sched/cpufreq_schedutil.c > > @@ -114,6 +114,28 @@ static void sugov_deferred_update(struct sugov_policy *sg_policy) > > } > > } > > > > +/** > > + * cpufreq_get_capacity_ref_freq - get the reference frequency of a given CPU that > > s/cpufreq_get_capacity_ref_freq/get_capacity_ref_freq > > s/of a given CPU/for a given cpufreq policy ? (of which the CPU managing > it is used for the arch_scale_freq_ref() call in the function. > > > + * has been used to correlate frequency and compute capacity. > > + * @policy: the cpufreq policy of the CPU in question. > > + * @use_current: Fallback to current freq instead of policy->cpuinfo.max_freq. > > Looks like use_current does not exists as a parameter. Thanks for the review. I'm going to apply your comments > > > + * > > + * Return: the reference CPU frequency to compute a capacity. > > + */ > > +static __always_inline > > +unsigned long get_capacity_ref_freq(struct cpufreq_policy *policy) > > +{ > > + unsigned int freq = arch_scale_freq_ref(policy->cpu); > > + > > + if (freq) > > + return freq; > > + > > + if (arch_scale_freq_invariant()) > > + return policy->cpuinfo.max_freq; > > + > > + return policy->cur; > > +} > > Reviewed-by: Dietmar Eggemann > > >