Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp288796rdh; Thu, 26 Oct 2023 02:08:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2a952g6GLb7cc6vjnJkEUCU2NNUIGfHajXcOJ4ATSUHegRWtggRRc1l5o8AHnr4SgMIhr X-Received: by 2002:a25:bcc6:0:b0:d9a:d8bd:7b9c with SMTP id l6-20020a25bcc6000000b00d9ad8bd7b9cmr3710078ybm.11.1698311288635; Thu, 26 Oct 2023 02:08:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698311288; cv=none; d=google.com; s=arc-20160816; b=SOuZqpJxn7xk3CYLXc6mwFe+JjiqSFIHl11nqK0/BCBF/bUNxIw7wvH0Q4rbniz3os /g1bLKVgdZtHXDeHNvx1hrnbvYNtI75nn+P697xIpnMBydpX4D45itciiYWT1A/Zb3UU 5yD/vbkwtzcVoY0eHpATKT6TF6BNbL5eMrjOYIOGMjqtLjtVITyD2c+su9q3YNa73tM9 ZXP04GkJehZ3eL+e0nBkLScuZ9NdY2UHl1kGu1XwRwpE0dd+/dyDVh36Ge7jN6KCtzu5 CEZw8KksAU70YxDXVyqTk1qShoU38DGuHjI7G+nX23QSdwrRXJ/n4HQpzozmtn93kVij dYew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=vp0elucTO/GiLE+CN8LHGiQwqepFX9liNCOK3bHVWSk=; fh=sc/xwyWfMRj+rL6on6Gip5nrP+69+0Gw3Pz32Wls4Vg=; b=eDAg2e5dmrvhBH1Z/YtF5VZiFFNnAem0Nw0HOcPHK1XdMsz2ASThyJjM30xuCXNbOu c54mUCSVP5gJx6YJmpON3B+5YdGb9H+uZLysuof+pzXrpWiGlF6FOlb94nRTOs56xmM2 Tw0u/auoQds1MsKWqTtW9oHiW2U2EDu3iGsI6nsxJibOCkmhjSWeBkhXTRBzYa9CxJ+X 6TBljroCd4hUdgkbcZt+YP+fDEV1J1zVQH7g+rf6qB8G+ekm2L0L8rqD3jtkXVUaUdPu 0+yHl1yk3L774hROCTvF81UhPPwhW2PnEWHLcuSFQIk3k0nG3IyDueo0u4TC4c4VpOwY sYdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id d204-20020a25e6d5000000b00da04c537291si6344328ybh.406.2023.10.26.02.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 02:08:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 663328212A96; Thu, 26 Oct 2023 02:08:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229642AbjJZJIF (ORCPT + 99 others); Thu, 26 Oct 2023 05:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjJZJIE (ORCPT ); Thu, 26 Oct 2023 05:08:04 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 44A7D128; Thu, 26 Oct 2023 02:08:02 -0700 (PDT) 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 5F3912F4; Thu, 26 Oct 2023 02:08:43 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9F10D3F738; Thu, 26 Oct 2023 02:07:58 -0700 (PDT) Message-ID: <6709d44b-39c3-414d-b0f9-fe217bb32876@arm.com> Date: Thu, 26 Oct 2023 11:07:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] sched/schedutil: rework performance estimation Content-Language: en-US To: Vincent Guittot Cc: 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, rafael@kernel.org, viresh.kumar@linaro.org, qyousef@layalina.io, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, lukasz.luba@arm.com References: <20231013151450.257891-1-vincent.guittot@linaro.org> <20231013151450.257891-2-vincent.guittot@linaro.org> From: Dietmar Eggemann In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Thu, 26 Oct 2023 02:08:07 -0700 (PDT) On 20/10/2023 15:58, Vincent Guittot wrote: > On Fri, 20 Oct 2023 at 11:48, Dietmar Eggemann wrote: >> >> On 13/10/2023 17:14, Vincent Guittot wrote: [...] >>> A new sugov_effective_cpu_perf() interface is also available to compute >>> the final performance level that is targeted for the CPU after applying >>> some cpufreq headroom and taking into account all inputs. >>> >>> With these 2 functions, schedutil is now able to decide when it must go >>> above uclamp hints. It now also have a generic way to get the min >>> perfromance level. >>> >>> The dependency between energy model and cpufreq governor and its headroom >>> policy doesn't exist anymore. >> >> But the dependency that both are doing the same thing still exists, right? > > For the energy model itself, it is now fully removed; only EAS still > has to estimate which perf level will be selected by schedutil but it > uses now a schedutil function without having to care about headroom > and cpufreq governor policy I see now. (1) replaces (2) so only schedutil and EAS, EM dependency is gone. compute_energy() max_util = eenv_pd_max_util() sugov_effective_cpu_perf() actual = map_util_perf(actual) (1) energy = em_cpu_energy(..., max_util, ...); max_util = map_util_perf(max_util) (2) [...] >>> unsigned long effective_cpu_util(int cpu, unsigned long util_cfs, >>> - enum cpu_util_type type, >>> - struct task_struct *p) >>> + unsigned long *min, >>> + unsigned long *max) >> >> FREQUENCY_UTIL relates to *min != NULL and *max != NULL >> >> ENERGY_UTIL relates to *min == NULL and *max == NULL >> >> so both must be either NULL or !NULL. >> >> Calling it with one equa NULL and the other with !NULL should be >> undefined, right? > > At now there is no user but one could consider only asking for min or > max. So I would not say undefined but unused OK. [...] >>> - * OTOH, for energy computation we need the estimated running time, so >>> - * include util_dl and ignore dl_bw. >>> - */ >>> - if (type == ENERGY_UTIL) >>> - util += dl_util; >>> + if (util >= scale) { >>> + if (max) >>> + *max = scale; >> >> But that means that ucamp_max cannot constrain a system in which the >> 'util > ucamp_max'. I guess that's related to you saying uclamp_min is a >> hard req and uclamp_max is a soft req. I don't think that's in sync with >> the rest of the uclamp_max implantation. > > That's a mistake, I made a shortcut here. I wanted to save the > scale_irq_capacity() step but forgot to update max 1st. > > Will fix it I see. [...] >> effective_cpu_util for FREQUENCY_UTIL (i.e. (*min != NULL && *max != >> NULL)) is slightly different. >> >> missing: >> >> if (!uclamp_is_used() && rt_rq_is_runnable(&rq->rt) >> return max >> >> probably moved into sugov_effective_cpu_perf() (which is only called >> for `FREQUENCY_UTIL`) ? > > yes, it's in sugov_effective_cpu_perf() OK. [...] >>> @@ -306,7 +329,7 @@ static inline bool sugov_cpu_is_busy(struct sugov_cpu *sg_cpu) { return false; } >>> */ >>> static inline void ignore_dl_rate_limit(struct sugov_cpu *sg_cpu) >>> { >>> - if (cpu_bw_dl(cpu_rq(sg_cpu->cpu)) > sg_cpu->bw_dl) >>> + if (cpu_bw_dl(cpu_rq(sg_cpu->cpu)) > sg_cpu->bw_min) >> >> bw_min is more than DL right? > > yes > > Interruptions are preempting DL so we should include them > And now that we can take into account uclamp_min, use it when > computing the min perf parameter of cpufreq_driver_adjust_perf() OK.