Received: by 2002:a05:7412:d024:b0:f9:90c9:de9f with SMTP id bd36csp42408rdb; Wed, 20 Dec 2023 05:59:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIHy/uVpjlFfVaJBPB0HjP+ET3c3SFbl4qsw9nNUO7H55wNxSLFWjjf2TtjFWLjaqgtaMr X-Received: by 2002:a17:907:3510:b0:a26:9d1c:a734 with SMTP id zz16-20020a170907351000b00a269d1ca734mr22640ejb.26.1703080795645; Wed, 20 Dec 2023 05:59:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703080795; cv=none; d=google.com; s=arc-20160816; b=PPbI3c3t5anfh2nJ3UDrJ2eHz5S9+FxIJVM+Pf89raUZ2S5WPQRazdkFYK27MIt5B7 Y7MdodYb4wzf7oF87tXaAT9Vz3ZR+6jiuK0LrcsOepKya1Bog8M+P/fH7ndPP4FREqQv a8/p70cpPCrKE3kGW4wrQcBL+pRzWqqIlHu8n8FYjdVkQReNZdfq6TiWWzBZwMFNXrZu 0cCQg8IBHfqpui9TOD+wDhuErae2N/Ag9+HdRSxMjMwZqbYrUUhWho6rhSvHkCjC1c3z BkgkvMfHTewWaClYs/il8GZzGEzdK3ypxvTHJdLLy/Zld+mzc2UASxvJpvQ45O7kRJbB 9tdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=SMjNlxioD1pET4ojPB/C9RHuhfOqSd6EevGlhbg/m3Q=; fh=l83Qd/Hao8IHqfNYwnLRy/m+/UdAPH+5PqS+1Us5X5M=; b=B2QlooqBc5o13xtg0GVnZkOkYKP6w7zYW49wYRHvZ/9PcoIJG9y6I0VlkA/FeqmEAJ oj/ndDUC+Y1seSWQCYWWB2ZS2vo8zsQ/WygMin9Ylu0aBlcUNhhJWZzPq2QFPXtyNhlT NgdmQI3sDQKnV/DdLIRWioc8StWWiE0ctHhAlXoSKvp42jCYiBpGUMgndOFd4a1mybm3 DHOQZLK2q5Yo7v9KkGeMg4XtGqVcoGGQzs3/+nEYfKA3+Nbvss7Y5zLc6NtHttvbMNDR 8ZiDubQrbvp/vz1v+uxnMlqr5HFASbMBPF4OBYRkRC0PSKKvVq8Xn/mRTmqileFBDn9L GEMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QPkv28Wo; spf=pass (google.com: domain of linux-kernel+bounces-7008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7008-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id g3-20020a170906198300b00a1de299f229si11937989ejd.439.2023.12.20.05.59.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 05:59:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QPkv28Wo; spf=pass (google.com: domain of linux-kernel+bounces-7008-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7008-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 676771F21631 for ; Wed, 20 Dec 2023 13:59:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8D07374FE; Wed, 20 Dec 2023 13:59:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QPkv28Wo" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pf1-f171.google.com (mail-pf1-f171.google.com [209.85.210.171]) (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 B7CB037168 for ; Wed, 20 Dec 2023 13:59:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pf1-f171.google.com with SMTP id d2e1a72fcca58-6d2350636d6so4923699b3a.2 for ; Wed, 20 Dec 2023 05:59:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703080753; x=1703685553; 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=SMjNlxioD1pET4ojPB/C9RHuhfOqSd6EevGlhbg/m3Q=; b=QPkv28WoRu3n93h45wm6ywojDMLSB5cuxODSdwpD9pXCIf0wuQ4zwHcWtcI2aTLpSF Y5Kf+PwEAeTCzNjLHYo37A6s5RC9gnRlBk5ay+BqFrz/K567KxGkHWftjh5gjKX4ofQT LbeAL8UsXBQR8VpEBMH8CYpNlPr8f+I1xT+25eRP0T59wXq+nXzV2b7pmFTmgpOOGoVJ FubIQYNvJP/+TCW8rQfvigS3GLJZij8a0DL4n50kL6mpe73YHmVHYZGULgXDPmIGZfOj FT1wtVm8Q1fwgPtRQZivnhb78d3w74sugLicHusFdW7xPATEGj8TMXzWKFcHPAWNvWni BdEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703080753; x=1703685553; 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=SMjNlxioD1pET4ojPB/C9RHuhfOqSd6EevGlhbg/m3Q=; b=Z/D3vHn+HfbDh3OCT4FGWn/AxSDxryf02BWpQs/1khpMgORDStadHjKYVc+D80epFr WJGU8kE2dx3tNagflR6jktkTRvt7QFPTdwa14HAPEAGHnKP5FEqQo+yy+rPsUmKromUo es6TuSpTJseZT6a+P0hjQ1Mljh+jT6bFjSTJtMHjQHXsY/XwgFhGW2v16CmxDyaQam9d nT7OMMS3BZvPPiqR+KnuNXqvBXhYKuiNNpqN//yao9l3bgV599C4WEd/gdaBKv4QXhpz mmx1oGp7nO6kdAoWdIu1TmnBzEvs7fcEvxsVzLkjeZ5KlzCFqrBr4mX7KfycJuER/Lot 9Djg== X-Gm-Message-State: AOJu0YzqFLFq6Dr6bodqTK3TdDBkiV8zMutSdA5Z8I4G7OGdUfRGlolA 8Bi3yX2HGHDk+iQLmKYDpOyRHusBXWyqKh+2ehYq5g== X-Received: by 2002:aa7:9d1b:0:b0:6d9:6712:f9ed with SMTP id k27-20020aa79d1b000000b006d96712f9edmr297610pfp.7.1703080753016; Wed, 20 Dec 2023 05:59:13 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231220065522.351915-1-sshegde@linux.vnet.ibm.com> In-Reply-To: <20231220065522.351915-1-sshegde@linux.vnet.ibm.com> From: Vincent Guittot Date: Wed, 20 Dec 2023 14:59:01 +0100 Message-ID: Subject: Re: [PATCH] sched: move access of avg_rt and avg_dl into existing helper functions To: Shrikanth Hegde Cc: mingo@kernel.org, peterz@infradead.org, dietmar.eggemann@arm.com, linux-kernel@vger.kernel.org, srikar@linux.vnet.ibm.com, yu.c.chen@intel.com, tim.c.chen@linux.intel.com Content-Type: text/plain; charset="UTF-8" On Wed, 20 Dec 2023 at 07:55, Shrikanth Hegde wrote: > > This is a minor code simplification. There are helper functions called > cpu_util_dl and cpu_util_rt which gives the average utilization of DL > and RT respectively. But there are few places in code where these > variables are used directly. > > Instead use the helper function so that code becomes simpler and easy to > maintain later on. > > Signed-off-by: Shrikanth Hegde > --- > kernel/sched/fair.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index bcea3d55d95d..02631060ca7e 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -9212,19 +9212,17 @@ static inline bool cfs_rq_has_blocked(struct cfs_rq *cfs_rq) > > static inline bool others_have_blocked(struct rq *rq) > { > - if (READ_ONCE(rq->avg_rt.util_avg)) > + if (cpu_util_rt(rq)) > return true; > > - if (READ_ONCE(rq->avg_dl.util_avg)) > + if (cpu_util_dl(rq)) > return true; > > if (thermal_load_avg(rq)) > return true; > > -#ifdef CONFIG_HAVE_SCHED_AVG_IRQ > - if (READ_ONCE(rq->avg_irq.util_avg)) > + if (cpu_util_irq(rq)) cpu_util_irq doesn't call READ_ONCE() > return true; > -#endif > > return false; > } > @@ -9481,8 +9479,8 @@ static unsigned long scale_rt_capacity(int cpu) > * avg_thermal.load_avg tracks thermal pressure and the weighted > * average uses the actual delta max capacity(load). > */ > - used = READ_ONCE(rq->avg_rt.util_avg); > - used += READ_ONCE(rq->avg_dl.util_avg); > + used = cpu_util_rt(rq); > + used += cpu_util_dl(rq); > used += thermal_load_avg(rq); > > if (unlikely(used >= max)) > -- > 2.39.3 >