Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3266302rdb; Thu, 16 Nov 2023 05:14:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IEVSv8i6Cq4992SXBdPNL+SAI1WvvjqVT2r1Y+sCzK+GKO+tLNCHtZWaqWIAn7LNKxEPYR6 X-Received: by 2002:a17:902:e744:b0:1cc:6e8f:c14d with SMTP id p4-20020a170902e74400b001cc6e8fc14dmr10248137plf.50.1700140470425; Thu, 16 Nov 2023 05:14:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700140470; cv=none; d=google.com; s=arc-20160816; b=v0VP3l5kZa26nEVb1+8dOoLfTUpNm12ZX8O8MQ2QGluwRw4OaeK+OQp9WvSL2Ph0bo xWN4zBPioYo5D3ImzhhEsQ7yXGHbf4VeAUo8IlXaGqMt7/Z0KF546me3zh9l1Nm6QvPk xcQhdTG068T9/T3aNrRj60PujbenLSVTP0P6FBuBXB/gZaYtePzl0GXCP4zO0ado0qkb 8XWQqcfOMq+KQyiEAFcDjzDh8J3M+YnAI84saoYYPVqyaX38HYJMl++hwCYVqU91CX4j hFKHPk85y7km3PwUC6OQ7ccBEYNYjfOkPM67fD/YKTQavw6TcUFcqNa43GAjZev7moTu NIKg== 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=Qdq4Dpowx6W8vb2n1PtObSpHJlqAyvOgaoZ4JAJ+OO0=; fh=UAxrhdjebYPnSrGg0VAS0tn+CyIL3G0BrP0CFRtbypA=; b=Dq7S600xuJRENpTdZ2iXnf0qzQ7XaZO4Mb2iHAccacyXl4xDcE2PZACg92/+h2/kuG D1pBBTsNeovnlgUcNCE7TlTGh1BqmHs02cG6OFfZERmD+O5JLb17Flk6FO4aIvDxOnB0 Wo3IEi5L49nuVuD1N5dNuX5++BWsAECc3lHY7li0psC41WSCwHmw9Vl3U1qW3YT432fc T6I7NgTkIrcy4ZYoZO95K5iRwdo3GPmpwGhHRrKbb6yNmCYmLDLU7hxDJFJuTUL/aHUc 18WF8QNcpGZN4297P/3bWTK1uinhixBA87JKJDKvAxaYyCoKSKlE0eVpgcl/hxPieEga iBeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u7-20020a170902e5c700b001b81a112f9bsi12890308plf.586.2023.11.16.05.14.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 05:14:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id A0B338184AA4; Thu, 16 Nov 2023 05:14:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345159AbjKPNOP (ORCPT + 99 others); Thu, 16 Nov 2023 08:14:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235757AbjKPNOE (ORCPT ); Thu, 16 Nov 2023 08:14:04 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7B66C19A3; Thu, 16 Nov 2023 05:13:56 -0800 (PST) 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 E72F41595; Thu, 16 Nov 2023 05:14:41 -0800 (PST) Received: from [10.57.3.57] (unknown [10.57.3.57]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 05F2C3F73F; Thu, 16 Nov 2023 05:13:52 -0800 (PST) Message-ID: <64f78eec-61fb-447f-bbba-706bd5a54cd7@arm.com> Date: Thu, 16 Nov 2023 13:14:49 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 1/2] sched/schedutil: rework performance estimation Content-Language: en-US To: Vincent Guittot Cc: wyes.karny@amd.com, peterz@infradead.org, linux-pm@vger.kernel.org, rafael@kernel.org, vschneid@redhat.com, bristot@redhat.com, bsegall@google.com, rostedt@goodmis.org, dietmar.eggemann@arm.com, juri.lelli@redhat.com, beata.michalska@arm.com, linux-kernel@vger.kernel.org, qyousef@layalina.io, viresh.kumar@linaro.org, mingo@redhat.com, mgorman@suse.de References: <20231026170913.32605-1-vincent.guittot@linaro.org> <20231026170913.32605-2-vincent.guittot@linaro.org> <83d6a790-3d18-4922-850b-b60e88761786@arm.com> From: Lukasz Luba In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.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 (lipwig.vger.email [0.0.0.0]); Thu, 16 Nov 2023 05:14:24 -0800 (PST) Hi Vincent, I know that there is v3, but just to respond to this below. On 10/31/23 09:48, Vincent Guittot wrote: > Hi Lukasz, > > On Mon, 30 Oct 2023 at 18:45, Lukasz Luba wrote: >> >> Hi Vincent, >> >> On 10/26/23 18:09, Vincent Guittot wrote: >>> The current method to take into account uclamp hints when estimating the >>> target frequency can end into situation where the selected target >>> frequency is finally higher than uclamp hints whereas there are no real >>> needs. Such cases mainly happen because we are currently mixing the >>> traditional scheduler utilization signal with the uclamp performance >>> hints. By adding these 2 metrics, we loose an important information when >>> it comes to select the target frequency and we have to make some >>> assumptions which can't fit all cases. >>> >>> Rework the interface between the scheduler and schedutil governor in order >>> to propagate all information down to the cpufreq governor. >>> >>> effective_cpu_util() interface changes and now returns the actual >>> utilization of the CPU with 2 optional inputs: >>> - The minimum performance for this CPU; typically the capacity to handle >>> the deadline task and the interrupt pressure. But also uclamp_min >>> request when available. >>> - The maximum targeting performance for this CPU which reflects the >>> maximum level that we would like to not exceed. By default it will be >>> the CPU capacity but can be reduced because of some performance hints >>> set with uclamp. The value can be lower than actual utilization and/or >>> min performance level. >> >> You have probably missed my question in the last v1 patch set. > > Yes, sorry > >> >> The description above needs a bit of clarification, since looking at the >> patches some dark corners are introduced IMO: >> >> Currently, we have a less aggressive power saving policy than this >> proposal. >> >> The questions: >> What if the PD has 4 CPUs, the max util found is 500 and is from a CPU >> w/ uclamp_max, but there is another CPU with normal utilization 499? >> What should be the final frequency for that PD? > > We now follow the same sequence everywhere which can be summarized by: > > for each cpu sharing the same frequency domain: > util = cpu_util(cpu) > eff_util = effective_cpu_util(util, &min, &max) > eff_util = sugov_effective_cpu_perf(eff_util, min, max) which > applies the dvfs headroom if needed > max_util = max(max_util, eff_util); > > EAS anticipates the impact of the waking task on utilization and max > but the end result is the same as above once the task is enqueued so I > didn't show it for simplicity > > Coming back to your example > CPU0 has uclamp_max = 500 and an actual utilization above 500. Its > eff_util will be 500 > CPU1 doesn't have uclamp_max constraint and an actual utilization of > 499 which will be increase with dvfs headroom to 623 in > sugov_effective_cpu_perf() > > The final max util will be 623 > > With the current implementation we apply the dvfs headroom to the > final max_util (which is the CPU0 with uclamp_max == 500) whereas we > now apply the dvfs headroom on each CPU inside > sugov_effective_cpu_perf() > > The main difference is that if CPU1 has an actual utilization of 400, > the max_util of the frequency domain will be 500 whereas it is 625 > after applying dvfs headroom with current implementation > >> >> In current design, where we care more about 'delivered performance >> to the tasks' than power saving, the +20% would be applied for the >> frequency. Therefore if that CPU with 499 util doesn't have uclamp_max, >> it would get a decent amount of idle time for its tasks (to compensate >> some workload variation). > > CPU1 with 499 still gets its 25% margin or I missed something in your example ? You understood this correctly. I don't have more questions. It should than work OK. Thanks, Lukasz