Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4221859rdb; Mon, 11 Dec 2023 12:21:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzIwq6fMaSzUnM0rI79A2XpJbvTiK9U+VXyEtiKttpO4I107h2peKhlcP1DzpTIrQl9rEJ X-Received: by 2002:a17:90a:d203:b0:286:6cd8:ef01 with SMTP id o3-20020a17090ad20300b002866cd8ef01mr6729801pju.25.1702326117942; Mon, 11 Dec 2023 12:21:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702326117; cv=none; d=google.com; s=arc-20160816; b=aQ8232jYmnaT+vmK97Fy/WSSTmbPgIQXgrNruAeSa2dhjNW65FjSmu3ca8rA4qIJ0/ XeZAqbAkk01TM5SYt9fA/OhZTSZqm3R5nQKHU+6SCLCSQW/OQ/28N/JYMkMt9TJK7D0n vpjJofHtCw+P/Kndt5BXkdl+DnUbS+1djVvxqKe7slp1KH1NqD9N95tD0rc0tj+d6vNB qchYw5RA9yKLy6Nc1nw0Xntcmc0wKYhxD1TB8w/YCGNUdeHJJgAgGAhNFy7/fPwBtOJ4 httGKHLz4Mx1gH3BbWFhiR8BDWh4b8YTbhQi+zqydY6TzImQXsmG1a99aMKD+DSLST9U K59g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=zZF5bH9XyzmJth3hnm/p8+LSpfALzWOHVU6je07Hc9E=; fh=xz4YSA51YI55dmiWpgeIr6b6Bz3JXp3vsxyEE3y2uhs=; b=TX6S+KvU4hP5vVIUGrSeajR6s6dsDmfq0Vpve2fHNwyS8nIiimO3B05QzYzBCwMZWQ THhj+8SZgkJ5OLoNiTbTW3t80b6neQLeh37G0+/7WgDnr3zKuaUiQeHlLr50g/3EX4z+ v8AqwlXsg0UGXaioDcvQvI36u9NpvSDeNaB4DzybSEoVkLfMyERAoUEwZqWn+m+bl2XL MnLASvLTNVQIDBEjA9p9LkaEN4uYm7vbzbn/NLLbIAv+SnMN7bH0GkxO8JqchZlnAX4H NS/K6z0m+pooNRYxr7gnfn5JsFwje1Wasg3OU/B8iTGUkgX5o2rm7hcmjaF0WN1Iz+mo NU6g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id f5-20020a17090ace0500b0028644ca706dsi7995530pju.171.2023.12.11.12.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 12:21:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 1C2BE8061C2F; Mon, 11 Dec 2023 12:21:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345072AbjLKUVV convert rfc822-to-8bit (ORCPT + 99 others); Mon, 11 Dec 2023 15:21:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345102AbjLKUVJ (ORCPT ); Mon, 11 Dec 2023 15:21:09 -0500 Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04D68C4; Mon, 11 Dec 2023 12:20:58 -0800 (PST) Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5907b9c3fd6so407938eaf.0; Mon, 11 Dec 2023 12:20:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702326057; x=1702930857; h=content-transfer-encoding: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=KdR2OSdlfkd+7aN8MdL4iIUqAicY4t8Ra3rktJ3z8SE=; b=tJRUYbsXOW31TXaf6p1jCDSBV56XVDINPMmvMkAFpy8+EyMeuDKAEPM0E7Dab+GTu5 93GRqxXv/0BwXCXOnLsSKd1Gy32m3GGx95wslMqvcbqdoAt6KLVyxUnyK5G7QqMlgoJB KTHh8m5y24oepm17LsJcJRoiSJ9EWhXXjUDf9woiDtWcsqkF8wThcKyCqlpJ/W4viW1P /AnjaCPYsb97q6ixNGzJ1AEI6V4gIx5t5o4cCnRMjfCO1hm+KUdE/MA9DBlOPKeTwTA0 mHBGoRcc0jP7ZHfBeF2UW0PqvOy8dbOJ4f7Qz+SpyeT2NeBJ66W+sMCgkBs5hXMu08sN XRrw== X-Gm-Message-State: AOJu0Yx0aVLnqSuOwW6sogzy7LIVnl5QGqxuQ7VDIOi2kCrzxhWfS+L9 dOjUUzoQu1AHy1VNkd8H+1rfzI1RMfpmnRNs0es= X-Received: by 2002:a05:6820:220d:b0:58d:5302:5b18 with SMTP id cj13-20020a056820220d00b0058d53025b18mr10519759oob.1.1702326057573; Mon, 11 Dec 2023 12:20:57 -0800 (PST) MIME-Version: 1.0 References: <20231208002342.367117-1-qyousef@layalina.io> <20231208002342.367117-8-qyousef@layalina.io> <20231210204032.fficzltp2gq66pne@airbuntu> In-Reply-To: <20231210204032.fficzltp2gq66pne@airbuntu> From: "Rafael J. Wysocki" Date: Mon, 11 Dec 2023 21:20:46 +0100 Message-ID: Subject: Re: [PATCH v2 7/8] sched/schedutil: Add a new tunable to dictate response time To: Qais Yousef , Peter Zijlstra Cc: "Rafael J. Wysocki" , Ingo Molnar , Viresh Kumar , Vincent Guittot , Dietmar Eggemann , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Lukasz Luba , Wei Wang , Rick Yiu , Chung-Kai Mei Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.0 required=5.0 tests=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 fry.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 (fry.vger.email [0.0.0.0]); Mon, 11 Dec 2023 12:21:55 -0800 (PST) On Sun, Dec 10, 2023 at 9:40 PM Qais Yousef wrote: > > On 12/08/23 19:06, Rafael J. Wysocki wrote: > > On Fri, Dec 8, 2023 at 1:24 AM Qais Yousef wrote: > > > > > > The new tunable, response_time_ms, allow us to speed up or slow down > > > the response time of the policy to meet the perf, power and thermal > > > characteristic desired by the user/sysadmin. There's no single universal > > > trade-off that we can apply for all systems even if they use the same > > > SoC. The form factor of the system, the dominant use case, and in case > > > of battery powered systems, the size of the battery and presence or > > > absence of active cooling can play a big role on what would be best to > > > use. > > > > > > The new tunable provides sensible defaults, but yet gives the power to > > > control the response time to the user/sysadmin, if they wish to. > > > > > > This tunable is applied before we apply the DVFS headroom. > > > > > > The default behavior of applying 1.25 headroom can be re-instated easily > > > now. But we continue to keep the min required headroom to overcome > > > hardware limitation in its speed to change DVFS. And any additional > > > headroom to speed things up must be applied by userspace to match their > > > expectation for best perf/watt as it dictates a type of policy that will > > > be better for some systems, but worse for others. > > > > > > There's a whitespace clean up included in sugov_start(). > > > > > > Signed-off-by: Qais Yousef (Google) > > > > I thought that there was an agreement to avoid adding any new tunables > > to schedutil. > > Oh. I didn't know that. > > What alternatives do we have? I couldn't see how can we universally make the > response work for every possible system (not just SoC, but different platforms > with same SoC even) and workloads. We see big power saving with no or little > perf impact on many workloads when not applying the current 125%. Others want > to push it faster under gaming scenarios etc to get more stable FPS. > > Hopefully uclamp will make the need for this tuning obsolete over time. But > until userspace gains critical mass; I can't see how we can know best > trade-offs for all myriads of use cases/systems. > > Some are happy to gain more perf and lose power. Others prefer to save power > over perf. DVFS response time plays a critical role in this trade-off and I'm > not sure how we can crystal ball it without delegating. I understand the motivation, but counter-arguments are based on the experience with the cpufreq governors predating schedutil, especially ondemand. Namely, at one point people focused on adjusting all of the governor tunables to their needs without contributing any code or even insights back, so when schedutil was introduced, a decision was made to reduce the tunability to a minimum (preferably no tunables at all, but it turned out to be hard to avoid the one tunable existing today). Peter was involved in those discussions and I think that the point made then is still valid. The headroom formula was based on the observation that it would be a good idea to have some headroom in the majority of cases and on the balance between the simplicity of computation and general suitability. Of course, it is hard to devise a single value that will work for everyone, but tunables complicate things from the maintenance perspective. For example, the more tunables there are, the harder it is to make changes without altering the behavior in ways that will break someone's setup.