Received: by 2002:a05:7208:3003:b0:81:def:69cd with SMTP id f3csp176955rba; Tue, 26 Mar 2024 12:32:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUec5ieNeX61F4IdLiRhaElWeM7csQ5tI2Lrb26RRQsHPPO7R71a0E7uJFQTM1HQNdo+v3UOT9lf43SnYxGrOXKw0+OlQstvBYAn58bdw== X-Google-Smtp-Source: AGHT+IGnoD71R8hbY4lC6rhqfJPm77ZRp8cn9CV2b5xOgFNOs9yQnT2E3NzenNdO+/fOhwcTaDPb X-Received: by 2002:a05:6214:76e:b0:690:d754:284 with SMTP id f14-20020a056214076e00b00690d7540284mr595006qvz.27.1711481564222; Tue, 26 Mar 2024 12:32:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711481564; cv=pass; d=google.com; s=arc-20160816; b=TVzSAVe9Wf5qhXDaV8Tel/Uwr6BVcOTVr0lTn+1WjsnUap2GxjKeA+3qjLmoMIn8q0 BPahsDRmlrjYt7vLvt1w7UtE3RMi9c0vs0b286yOz2DlCXNZmIDS8PqGCb+PTkdm4QCX T5eui3TzgbKtiXeyU8MGaX4Khgcj9+HNZpAF2d+xpDSauA7LWxxu1vqRwv4UGf/G7a1d tTfAV/tWcEjUdvWMa00urPC6K3noBdUx7MC/s4aAA7yyrh7kInHNhzrZg0JnFSOtxhA4 gkrZQTDFhs4DbWcScnL5iT7n0e1Qflob7GXTo90pTl1cjPeZEvR+lgJzA9dKSHCQ5or8 wZpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:sender:dkim-signature; bh=iFsAgCFr+w/nTt11Lu+H5UTp3Q2SaaYj41jQ35tN2FU=; fh=PKGFV7yb9Iy0p2c2L5ocLRsbCq7GSKlOke5YczqhRz0=; b=I8mzm9hmhtpd3XmfKJiAAWkOiOVMRemtym+8OoIi8odUVoMqYEbgi7KvoDun9BM4zu jOxyffxHWAZIjtL4vst7bc/NKScDN1HMuRe8qrv9HIcgZxuxLQqswDWVSCuQYz666jyT vYB2pk+Cutrftm1JQRzdIuKxa7cHfVMexGvOMoL5SrQ2F0QDPCLwIlkdSK08nirk5y19 OxksX16gPk8MZktas1t1b+0G8LQz0cg0YITzdkuRMF0VTxyiS5VdL5c2azHLHW/CJkhL FZ4BMl3vcr+akqT3PYzvXDLUfPdsUBdLet/QXwe6eWnvoiGZ4akT6a5vyaGJ6TFsA4vc rVVw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=C7o5nuNC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-119811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jo23-20020a056214501700b00696116cae24si4757384qvb.129.2024.03.26.12.32.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 12:32:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-119811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=C7o5nuNC; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-119811-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119811-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A48121C603A5 for ; Tue, 26 Mar 2024 19:32:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EDDC13D24C; Tue, 26 Mar 2024 19:32:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="C7o5nuNC" Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 76A3713CFB7 for ; Tue, 26 Mar 2024 19:32:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711481558; cv=none; b=j57O1RE1uVqq8Mlxfem7l2oTivCMTq7tOdNALcKBprqFDFsUkhJF+Udoyc+KI6R6I66lvWJyGH8mcVohLVlbxQWsvYl5JByNVm/dXv4vzbJIReRHZFbJGOjeCUxU+V6WwMZT9PUEhJARWGLtUq3gcjXAKVU7FX7fYM6ioieuE/Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711481558; c=relaxed/simple; bh=IPTD8oL30airMY5JK2E65jlSfMHn9jgIs+D1MlKnlpA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=c8o2Ad2kq0MeXH1Q7gncnovh/8GLooUgo1bqZ3Suc9s1X0Pwbw3QXv69deWQMEJ3sTOtZBWz60x2uoNa/Y9NeKqrlkP4spEBdDj1tuHHwcyeA92D7TiB/DWPGM2SkAaYzjfUVZdUmSGEVsRPwNh8csW+H6u+J1AWHGv+n4IPyH4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=C7o5nuNC; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-414925779c2so2157875e9.2 for ; Tue, 26 Mar 2024 12:32:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711481555; x=1712086355; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=iFsAgCFr+w/nTt11Lu+H5UTp3Q2SaaYj41jQ35tN2FU=; b=C7o5nuNC+JDg8EPyRVZir+KE5UFYursRzxgx9ZIy6S1IOBKhAcDhsROD+ig+aELUXU 4/UmZQzmLHpKLhLd6sF8aqgtm87PSoZc20WYnRmgHb0Oxiru5gh6i3AiIstAGFGQjM8D P7DyXraiyYSyiMItieEs6j4e9EIcV2JiR9F0RHvJtgO0u2T365R2eAtIcwWKkDzGAWsn 7Es1sVjH6umICbeWKQDspuxi6N2IhTB3Zvg8zCTMOeON72/ZSkGZrSEXxY+Rkzq/nJRW eNM+f7mG4zM82EcAeY5qxUfvSvk/w4MqT3GlWACdc0ndw4C1xv03I7w+/sfFPAf8OwFI rbAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711481555; x=1712086355; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iFsAgCFr+w/nTt11Lu+H5UTp3Q2SaaYj41jQ35tN2FU=; b=KbLoAtLI/wTcbDYw9eT/6HQMSLCr6RlNBYw0wRsMaiBNhpB0Qgp9huxuo8p9hI96Xf sIdZfTAo7AH8CZec1VJWcOwIuMtW1sM81v3nZCMCBmc8/hmLwP0ZvjZ6CxaQBYYwWE1e qEiL9e/67G3lhA1Zd5JhSesYetTprqN7+oYUre+t8OVsLW4lz4DlTB14VI95glatJdKG v+xmHUMcjL/TS11niTwqFC9RwNLlDZK/890MrEKf3qr52JU9PSzDfTy1FGcPTwr2LrDG KqCJWEeydTqGLaKlcpnA1zE0dhZkop49j8Cuazw3w+AIbBFacjAO+pZMk+vM4AGKL2nL YtPQ== X-Forwarded-Encrypted: i=1; AJvYcCWb/x5ohXzleMTSMEQe5a11Wdi3hMHKgiBYuEM2NcpIfXWCWOzAn3xgG5dlV4fHmoBDE4+BJwfbAxNmhwAoP2g2zzTjEHvTas2W5SQt X-Gm-Message-State: AOJu0YwfsQrbiAAXgRREtQDeUdO1UsHo+AYdHiRSYWNuM2MJXKEN5/Bj lFPeSBOvVfeAIQfx52Idt/hM2I2+71zWZnYh4MHssNXasUC3rX1M X-Received: by 2002:a05:600c:1547:b0:414:88a2:fb7b with SMTP id f7-20020a05600c154700b0041488a2fb7bmr359887wmg.11.1711481554422; Tue, 26 Mar 2024 12:32:34 -0700 (PDT) Received: from gmail.com (1F2EF63C.nat.pool.telekom.hu. [31.46.246.60]) by smtp.gmail.com with ESMTPSA id f12-20020a05600c4e8c00b00414850d567fsm10444617wmq.1.2024.03.26.12.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 12:32:33 -0700 (PDT) Sender: Ingo Molnar Date: Tue, 26 Mar 2024 20:32:17 +0100 From: Ingo Molnar To: Shrikanth Hegde Cc: peterz@infradead.org, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, qyousef@layalina.io, linux-kernel@vger.kernel.org, vschneid@redhat.com Subject: Re: [PATCH] sched/fair: Combine EAS check with overutilized access Message-ID: References: <20240326152616.380999-1-sshegde@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240326152616.380999-1-sshegde@linux.ibm.com> * Shrikanth Hegde wrote: > Access to overutilized is always used with sched_energy_enabled in > the pattern: > > if (sched_energy_enabled && !overutilized) > do something > > So modify the helper function to return this pattern. This is more > readable code as it would say, do something when root domain is not > overutilized. This function always return true when EAS is disabled. > > No change in functionality intended. > > Suggested-by: Vincent Guittot > Signed-off-by: Shrikanth Hegde > --- > kernel/sched/fair.c | 20 +++++++------------- > 1 file changed, 7 insertions(+), 13 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 24a7530a7d3f..e222e3ad4cfe 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -6686,12 +6686,11 @@ static inline bool cpu_overutilized(int cpu) > } > > /* > - * Ensure that caller can do EAS. overutilized value > - * make sense only if EAS is enabled > + * overutilized value make sense only if EAS is enabled > */ > static inline int is_rd_overutilized(struct root_domain *rd) > { > - return READ_ONCE(rd->overutilized); > + return !sched_energy_enabled() || READ_ONCE(rd->overutilized); > } > > static inline void set_rd_overutilized_status(struct root_domain *rd, > @@ -6710,8 +6709,6 @@ static inline void check_update_overutilized_status(struct rq *rq) > * overutilized field is used for load balancing decisions only > * if energy aware scheduler is being used > */ > - if (!sched_energy_enabled()) > - return; > > if (!is_rd_overutilized(rq->rd) && cpu_overutilized(rq->cpu)) > set_rd_overutilized_status(rq->rd, SG_OVERUTILIZED); On a second thought, I'm not sure removing the open-coded sched_energy_enabled() branches is a good idea: the current code makes it really, really clear when we are within EAS code paths. Hiding it within is_rd_overutilized() makes it a lot less obvious IMO. And this one: > @@ -8202,7 +8199,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags) > cpumask_test_cpu(cpu, p->cpus_ptr)) > return cpu; > > - if (sched_energy_enabled()) { > + if (!is_rd_overutilized(this_rq()->rd)) { > new_cpu = find_energy_efficient_cpu(p, prev_cpu); > if (new_cpu >= 0) > return new_cpu; Didn't have a root_domain::overutilized check before? Thanks, Ingo