Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp125210rdb; Tue, 31 Oct 2023 02:49:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHdlcTIcG0SSCzK8K35CxTiKjILUOFJUAL4Di06C6UdALggge3uKXo5M7PpRwgrg/tDrp27 X-Received: by 2002:a17:90b:1e47:b0:27d:1f9f:a57f with SMTP id pi7-20020a17090b1e4700b0027d1f9fa57fmr11883369pjb.32.1698745758744; Tue, 31 Oct 2023 02:49:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698745758; cv=none; d=google.com; s=arc-20160816; b=ILtb0bqWnAiyNYbzOJNKO2DjPwraQwCxH0hoEikCjoxSI5ZvbY8+iE1F3JWCLH2HVO q5ZJlj73baGRtmCXMJujj/WPncTaj6EHkDS3crOCbiaq4SyYKFrGrcrW3P6GK2nyKB4o zYvmeT8JZ7BxfHHX1cuEwVW52naRO2IzqU3tOoVzHPnh29a89Ou22n8UovnNWZAKIZqm jmbaa0TvYwm1x03QvQkvWz173bbD32tNGM85nmm/EFuV6wF1m8EZunZXd29oOvWpDIGe ObXx6rtOOl4NzzVWYCYC5HzDK3lxXDzgZFc3vk+5lGPkXyDgBtdGSTgA7ZAKQDaErs79 1bPg== 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=rYhUK3Ef9ZtO2nV4gKtW07Ip2faB9tXLb6bMWZbknSY=; fh=SpW7iJxW0nvsIQ8nywck+2Zhj3G59NSSb1nolzkTrDY=; b=BvIPXUBmlk/wVKQLfMU28Mc7NFxVjioLGTbzJKLYgxrRV7A9eZLg8f3MW8kKnJIp3G fzz/PESsPzb+h1OM4H5+6+UxhHYoBCp9wyXIp6/5wEt9XOT4XcHFUeYQKQcdKz9HXHsB nspC/mp8j2LZYiQWVLpxzpJXyrVqCsbj7gTL9JHL8DPBFBEqstp7EJLN+jHnj/871vU3 XVSPFW/9CHM+dLdazPfA7QhSpIhv0FYE2uTJujPPhuzBbayObMwMJ8pWsjRHBt389J2n QfsgVkSvZD1IlUt0BWKWXXcVsShppnw1YE/YVWJEQjat1htdnFYGGZ9XD11MoWdM4O0b 7gHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVdlKeYN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id nv3-20020a17090b1b4300b002747da1ef66si740008pjb.53.2023.10.31.02.49.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 02:49:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FVdlKeYN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id F312680C5CAF; Tue, 31 Oct 2023 02:49:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230464AbjJaJtC (ORCPT + 99 others); Tue, 31 Oct 2023 05:49:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230457AbjJaJtB (ORCPT ); Tue, 31 Oct 2023 05:49:01 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7D6ED8 for ; Tue, 31 Oct 2023 02:48:58 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id 41be03b00d2f7-584a761b301so4316447a12.3 for ; Tue, 31 Oct 2023 02:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1698745738; x=1699350538; 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=rYhUK3Ef9ZtO2nV4gKtW07Ip2faB9tXLb6bMWZbknSY=; b=FVdlKeYNVbGwEj3wWYnJ5gODeiJ5bwzsZvcEPknKdezwtdQudLj4cg0uBWfIOpVTHO a99vfA04iUnIAHecg4wJtKl+CsM7j1DPCx89szuF+eZxkAc/2w9YHlVzk9MUE0lsHQBB 8FU3rtRTAx1c+VjjTZ3sGjSR8QXJhpoLcrspLZgOhZ+ZR2ST/GS8NSqvcBklPeMr+4AC CPWnjE7sDrXZFpainFHvOUR3uXIFHh44YjEL8VEiHKjmH1wBVasrizRrA6hQ534f8BOk fgnS9kvwnala+iYDC6TQfVQs/SKJRr2uw4a/29ExQzKhLDYu5UjeQZfno/E4xlM2evr3 PE+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698745738; x=1699350538; 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=rYhUK3Ef9ZtO2nV4gKtW07Ip2faB9tXLb6bMWZbknSY=; b=eL40EaAu3iVcSUDyxuhwEgfKWiqArVKu1oxDVMe7bGdEd0XLhcY/6YvXSFV4lS9jGm fES4weG3f5g1++CXxJONFs8jjwtJ35A4gAhgH8TCNNFndf60gYmLX7weLIRL95Mj7SE5 1Jub8EPoGjt9/pOFGeC1I86qDpqaltQhpZ0ajTxOq/3os7Mfy7TbZVyZmbgsz6g3i+v5 zoDlK5cuLFjrwG8SLZv5/OAq2s79nH4/ys/MIEESea1wRu7a8ltccZGyJjsSA5M/45Vj +wT0pevzjdAtk7IEUv2rAUgA6PKByryual3YSrrpgywsmHJypb5EzBWjQ0CyElkyEVRl zoeA== X-Gm-Message-State: AOJu0Yxnj458KWRgG+hJPmAq9aGGPAsW4qNZPxi8J52A9X1LENFn6fej 5Zf0K2AJX4WlrQhDSd+nCFESIg1ue02rhcD2b0JYxA== X-Received: by 2002:a17:90a:19ce:b0:280:2985:56af with SMTP id 14-20020a17090a19ce00b00280298556afmr7095622pjj.45.1698745738085; Tue, 31 Oct 2023 02:48:58 -0700 (PDT) MIME-Version: 1.0 References: <20231026170913.32605-1-vincent.guittot@linaro.org> <20231026170913.32605-2-vincent.guittot@linaro.org> <83d6a790-3d18-4922-850b-b60e88761786@arm.com> In-Reply-To: <83d6a790-3d18-4922-850b-b60e88761786@arm.com> From: Vincent Guittot Date: Tue, 31 Oct 2023 10:48:46 +0100 Message-ID: Subject: Re: [PATCH v2 1/2] sched/schedutil: rework performance estimation To: Lukasz Luba 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,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 pete.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 (pete.vger.email [0.0.0.0]); Tue, 31 Oct 2023 02:49:16 -0700 (PDT) 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 ? Vincent > > Regards, > Lukasz