Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp3694466rdb; Sun, 10 Dec 2023 17:17:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqQrIZl5o3drwQ+anbZrV3s4kZpd7e1++RBiNQY5cYefaV1IR46HQGdZ9k0qQ/6bUyTUkQ X-Received: by 2002:a05:6a20:d413:b0:18f:df5f:d9f6 with SMTP id il19-20020a056a20d41300b0018fdf5fd9f6mr4041031pzb.57.1702257444640; Sun, 10 Dec 2023 17:17:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702257444; cv=none; d=google.com; s=arc-20160816; b=EIrVrExv82CTZJpEeQ8SqiVIEwxfjAD/sPA1TAvboPGvFDfQhf6zGrSA5VDT93FBxN opcEenayfzxkzHws0wq199ZM1n7aw3duwjQ8tbFb228EV4NnN6k5D3LboxuiT+VILQii cKZyLxxTcdGQbhTBTiSRcpku54dsYAjAzzlul1+BnaAp8cDT1kK8V4q3KNHhzoElZ/lL AJDLvTngjzI783VP/WBLJlGrwGWSOsnGcxowsrCeHF26tchZhpT1kF7upQQ5z3g9hCrl /K3HwsyGdM6OuN9DBwiGztZ7CmpiXIgNJ0c6CNMCIHAouE26dQ6mOyE7Wy91Qq6bJ4gZ uTdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TVYCyVS3+ff43Qu6NzjIwTDiljR88wG6SCIsO7lLWds=; fh=X4ux9vd6xZ5NU1ocB7RfYLyOklof03hbXkh3QuPe0Ns=; b=UNtFlnb68EkwBHsnbyUc84mzoqx8Nj/Wz3gDHlJgSCbq0ga6Vxwx5hUX+3ZRQgl3EC lYhG7j5eqgHmR5P6utitnSy4Hg4S7X67rVnyyfDIrn8vb09rXx0IE3GIBIxC3KNGKGf3 KxHf+7JMs7KVFFpKMAxwKsItiCCg7Hm2xjXAU46TOAHmWrZKJCbRT3S36ecJlCGSn27E 6aPD3AfptueohU+Br9fjUsW4oBI2uoXP+HVhRyQQaCuZ31pevoDBOLsJJoLTtU989FSV hSxWIveote7XsBC938DSHLza1JnWPLyvF8RFMhKq6bAZuB+gskQgS+mSaGNtb2GPmuHH rcvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=hUDwjp8k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id 6-20020a630d46000000b005c662419214si5208429pgn.229.2023.12.10.17.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 17:17:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@layalina-io.20230601.gappssmtp.com header.s=20230601 header.b=hUDwjp8k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 7AF0E8079AEB; Sun, 10 Dec 2023 17:17:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229678AbjLKBPH (ORCPT + 99 others); Sun, 10 Dec 2023 20:15:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbjLKBPG (ORCPT ); Sun, 10 Dec 2023 20:15:06 -0500 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45ABEE3 for ; Sun, 10 Dec 2023 17:15:12 -0800 (PST) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-40c29f7b068so37684695e9.0 for ; Sun, 10 Dec 2023 17:15:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=layalina-io.20230601.gappssmtp.com; s=20230601; t=1702257311; x=1702862111; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TVYCyVS3+ff43Qu6NzjIwTDiljR88wG6SCIsO7lLWds=; b=hUDwjp8kWW21rshJ2xD5xVe1/v2MPrdMkSORUL5685RPBIDOdhsxQEBTgDphBI2WYe SrafVbt/3Jh1c/wZZTlozayYEBnCg7F0nKklHjAEO97ZTDXa6fO+vf4ORVqnO1USBhxl 1Lx82BN+lJ0cYktMWp+EKyWHhVVjDFz9LYlqcvKodiv1AdSrfUVUVdg7DeXtMZ36I3Tv 1QKztmHsmTsu7GKiA5/B53C85W1kJly3uaZc/tvdYSpMzJn/U2qVuZBSdtXyWGLR//QF 8uEVFfsHnEalP1E9KxbNNCbTIYeLhGA0JYCkLcmZgZkQyvUPmwyS8HKS5UzKny+oE51F lwuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702257311; x=1702862111; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=TVYCyVS3+ff43Qu6NzjIwTDiljR88wG6SCIsO7lLWds=; b=oKnJWo4gojSmSzC8fgDJ+HFeIX4XToZg2C1hqHKo2+UpDvfbpGDOL5QVqEfPIp0tHk B3AyKMGxD+cePBHQM9MnieFrQWNNvXZ2l0/bTS80Qg16Q703jmcjBAlHbaUrcir5GN5g 8fav9S57y0yLvETuSOZ6ZMBqR7RaTeYVwOapFFrzJ4CEoTjtn8T6xivFYQHa6VgDFhiT /2HCA7+y14Z1s3azXcx89eQ32ScnsJR3Gi2zssBLCZrLzhReVITu18KN3Ovs4hLZet4z Np97MXqNfcdLshcUiaEHdSnwTQ5sXm1weayFbQOSRKX/O/pybTXQRWFJT0RkMCNfvpf/ ilFQ== X-Gm-Message-State: AOJu0YwZg0/TcYXt6U89BvlBpbh1SdaKARaBunouP8XDbqgklo2xqbgc +2B0BNdY6B51d6u7f3zkYZo3fPEktCZmcctOmMM= X-Received: by 2002:a05:600c:2294:b0:40c:2328:fcd with SMTP id 20-20020a05600c229400b0040c23280fcdmr1585213wmf.135.1702257310691; Sun, 10 Dec 2023 17:15:10 -0800 (PST) Received: from airbuntu (host109-153-232-45.range109-153.btcentralplus.com. [109.153.232.45]) by smtp.gmail.com with ESMTPSA id fc17-20020a05600c525100b0040c42681fcesm4316862wmb.15.2023.12.10.17.15.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 17:15:10 -0800 (PST) Date: Mon, 11 Dec 2023 00:08:09 +0000 From: Qais Yousef To: Ingo Molnar , Peter Zijlstra , "Rafael J. Wysocki" , Viresh Kumar , Vincent Guittot , Dietmar Eggemann Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Lukasz Luba , Wei Wang , Rick Yiu , Chung-Kai Mei , Hongyan Xia Subject: Re: [PATCH 2/4] sched/uclamp: Remove rq max aggregation Message-ID: <20231211000809.qostlrd5bka6cvak@airbuntu> References: <20231208015242.385103-1-qyousef@layalina.io> <20231208015242.385103-3-qyousef@layalina.io> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20231208015242.385103-3-qyousef@layalina.io> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, 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 morse.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 (morse.vger.email [0.0.0.0]); Sun, 10 Dec 2023 17:17:22 -0800 (PST) On 12/08/23 01:52, Qais Yousef wrote: > +/* Request freq update on context switch if necessary */ > +static inline void uclamp_context_switch(struct rq *rq) > { > - return static_branch_likely(&sched_uclamp_used); > + unsigned long uclamp_min; > + unsigned long uclamp_max; > + unsigned long util; > + > + /* Only RT and FAIR tasks are aware of uclamp */ > + if (!rt_policy(current->policy) && !fair_policy(current->policy)) > + return; We have a dependency on min_granularity_ns (or base_slice_ns) here that I forgot to add before posting. If our base_slice_ns is smaller than dvfs_update_delay, then tasks won't run long enough for the hardware to apply their performance hints before they get context switched out. Beside the new proposed sched_runtime being able to request a smaller slice; in practice default base_slice_ns is okay-ish. > + > + uclamp_min = uclamp_eff_value(current, UCLAMP_MIN); > + uclamp_max = uclamp_eff_value(current, UCLAMP_MAX); > + util = rq->cfs.avg.util_avg; > + > + if (uclamp_min > util || uclamp_max < util) > + cpufreq_update_util(rq, SCHED_CPUFREQ_PERF_HINTS); > }