Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp458119lqs; Tue, 5 Mar 2024 07:03:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUB4hH9PlEoiSddI8UefOZnK23XHtlA/nnNOYWgVqsrwAxz35VDMmAWRjt77Bb6UQ8T/UJyPtLikh8vWZZucpM9rGJmd3nq9NDGsuPZ0g== X-Google-Smtp-Source: AGHT+IFY3wN6uVeTCmSuHCLzHQ8qKvQ42HH5lZNUI+gCLkHJLAyhNyAKzZiAYDpj5FO2Ew9G5k1y X-Received: by 2002:a17:906:1192:b0:a45:6ffe:c0e5 with SMTP id n18-20020a170906119200b00a456ffec0e5mr3320953eja.18.1709651030217; Tue, 05 Mar 2024 07:03:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709651030; cv=pass; d=google.com; s=arc-20160816; b=dviSEgFDMbPdJgP0No9UmUFnAW4nysDXuEjTYvvZZNpVAenHQ5IBuOr0GAgobjGojG bbe6MvtVaCD9z31npdqxxL/04C7SrceiuUdGaQ0OQIbeg9xIasqwsREiIfViupzNKu4E pa/IRxP88AvRLAnld88B2yaPxXM+C2+qnYfYMwhIrszU4e4TmXx1Q7glvGKGSUEXx8c5 j9TU0ReTAY3fjTcC1xblG0QD/TtwIkCpaSDZxl98PmcwbVy9ALXZ5eUpoqOQOBb6WRw8 kjMzdU9+onvAMoOvxpw9iH1lHKK3Ao4qhIkFVFy++oqV98qs/ydNn2nw98IHwK2f+YNy LIpw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=d+err22il2gKfp4Cq1EkZkWnxavfLbojN62KH00FfHI=; fh=IcTQTR69h2iaEDD/7zLQb7bKnLtfwQsDeClEA/7Gouc=; b=R1FPPM8gjxQvmA/kRlZa0p4GISPPH4hZWZtvLax56LVaQ+uQa4K2y/QTZz0YzZ9NWc JTvT4g+rzV2nab3QYPnwXkvbr3M4mozW7dwPDsRWgkuvM+/S81SK64qm5dqkOHEgxQwI +OeC+1Tae2qro0MkBbVTxFmxV3J94FQOgBe5g0l7HDKVXEfDyQ5nv27oIzTH8hBs1VNo y1jIZtiDVnLib4UQIHOP+nO5a685bcurnu2Ica5VWzgn4hrDiYw70DxYggUVdsqPyrH3 l1Z7Swm0CSERVEfhp7ivvznkp8P/AkXsj1CUmJ29VaLs39Ate3vVkvGSjnUObtNXYDUK MWLA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ACrryp5E; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-92570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92570-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v14-20020a1709060b4e00b00a458d17e081si1180354ejg.221.2024.03.05.07.03.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 07:03:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92570-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=@ibm.com header.s=pp1 header.b=ACrryp5E; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-92570-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92570-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com 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 C18FD1F23728 for ; Tue, 5 Mar 2024 15:03:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49AC0126F30; Tue, 5 Mar 2024 15:03:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="ACrryp5E" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 05255126F02 for ; Tue, 5 Mar 2024 15:03:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709651021; cv=none; b=e5yZRCgDnMu8aSDIuX2rt3+jgeD452BC6OVOUbUN7dOiQsu0m2lWpurDd3eiAeCpnzZVgnYmsPG9D9ii2NIpFSCEiBH4JDjRcq57PdwCgwPk8WKodnvxaeNvFdcPgt8ye/EHCp0BwMN6HFO3hpXFIzTJBRV2x1V/vZfpPvULp6k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709651021; c=relaxed/simple; bh=ovK+xDrXZozbhrnptM8u3dp58JPuSazr4S6Xn+dv9UM=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mr8two4xuKImpt0QIDMjkpWj2WamabK8Sot7OMA7zf1+1gJHyW7q2sHjQI0vaSi5RpGIDymR9PEtmOIf9Qqc4kBBPn5b1HCZQuvD4rSLvUatyotwYh9gmC0nH5Odvl/S8cCWr+tM9JHclYAwrMr/VaECH18NUw29jyy9LvOR0dI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=ACrryp5E; arc=none smtp.client-ip=148.163.156.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 425F205f003563; Tue, 5 Mar 2024 15:03:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=d+err22il2gKfp4Cq1EkZkWnxavfLbojN62KH00FfHI=; b=ACrryp5EN5E0FMRjeX3wnQcZ2fkKYbP6lu06pb9PfEKB72CFm/A3gPXungSWnjv6Un6n FAU1N2zc/Yan9lA2TsZj5tS6cA2nYgQTVwFoZZwWRdUrhryctq9FAuiCcXjw831xQViq /2hk8cD4NnzLeq9y5/cLhSOlqZJoPVR3mDKvECLdp0+VXIohiI+4bqKMPPb899R9cSkK vO0Oki18hnT60j6CEH+c0iB2vrv68RC0frGZqBT0h+XFJiJv7Ufm2xgejSOiZOwP6SCy Tyq2jhWtbJ/Z5WF69L+5DY5FHrAj9Fcy1QW2yGdOB/hyM4QHXEDRAsyDqHxkqgmpdswf Vg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wp5p6r2wt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Mar 2024 15:03:28 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 425F3Qlw011423; Tue, 5 Mar 2024 15:03:26 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wp5p6r2r2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Mar 2024 15:03:26 +0000 Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 425DXsWm026296; Tue, 5 Mar 2024 15:03:23 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wmfenr8bk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Mar 2024 15:03:23 +0000 Received: from smtpav04.dal12v.mail.ibm.com (smtpav04.dal12v.mail.ibm.com [10.241.53.103]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 425F3Kie25166156 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Mar 2024 15:03:22 GMT Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F48558052; Tue, 5 Mar 2024 15:03:20 +0000 (GMT) Received: from smtpav04.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44CA858056; Tue, 5 Mar 2024 15:03:16 +0000 (GMT) Received: from [9.43.117.244] (unknown [9.43.117.244]) by smtpav04.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 5 Mar 2024 15:03:15 +0000 (GMT) Message-ID: <251f9b0d-3e00-4ca7-829b-e622fc0b4c49@linux.ibm.com> Date: Tue, 5 Mar 2024 20:33:14 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 2/2] sched/fair: Use helper function to access rd->overutilized Content-Language: en-US To: Vincent Guittot Cc: mingo@kernel.org, peterz@infradead.org, yu.c.chen@intel.com, dietmar.eggemann@arm.com, linux-kernel@vger.kernel.org, nysal@linux.ibm.com, aboorvad@linux.ibm.com, srikar@linux.ibm.com, vschneid@redhat.com, pierre.gondois@arm.com, morten.rasmussen@arm.com, qyousef@layalina.io References: <20240301151725.874604-1-sshegde@linux.ibm.com> <20240301151725.874604-3-sshegde@linux.ibm.com> From: Shrikanth Hegde In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 1Ea4MRrRlDrGcFoCfwWxYweaSFcUsZk4 X-Proofpoint-GUID: kJZIEEvi5Hx6_BzxpNDfBek9WyZQeb1f X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-05_12,2024-03-05_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 phishscore=0 impostorscore=0 bulkscore=0 adultscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=789 spamscore=0 priorityscore=1501 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403050120 On 3/5/24 7:35 PM, Vincent Guittot wrote: > On Fri, 1 Mar 2024 at 16:18, Shrikanth Hegde wrote: > > > It seems that is_rd_overutilized() is always used with > sched_energy_enabled() in the pattern: > > If (sched_energy_enabled() && !is_rd_overutilized(rd)) > do something > > This pattern includes feec() case where we have in select_task_rq_fair(): > > If (sched_energy_enabled()) > feec(): > |-> if (is_rd_overutilized()) > |-> goto unlock > > which could be changed into > If (sched_energy_enabled() && !is_rd_overutilized(rd)) > feec() > > Then you can create the function is_rd_not_overutilized() instead of > is_rd_overutilized() > > -static inline int is_rd_overutilized(struct root_domain *rd) > +static inline int is_rd_not_overutilized(struct root_domain *rd) > { > - return READ_ONCE(rd->overutilized); > + return sched_energy_enabled() && READ_ONCE(rd->overutilized); > } > > and use is_rd_not_overutilized() instead > Ok. Makes sense. I will keep this patch as is. and use the above approach in a new patch. >> + >> static inline void set_rd_overutilized_status(struct root_domain *rd, >> unsigned int status) >> { >> @@ -6686,13 +6695,14 @@ static inline void check_update_overutilized_status(struct rq *rq) >> if (!sched_energy_enabled()) >> return; >> >> - if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu)) >> + if (!is_rd_overutilized(rq->rd) && cpu_overutilized(rq->cpu)) >> set_rd_overutilized_status(rq->rd, SG_OVERUTILIZED); >> } >> #else >> static inline void check_update_overutilized_status(struct rq *rq) { } >> static inline void set_rd_overutilized_status(struct root_domain *rd, >> unsigned int status) { } >> +static inline int is_rd_overutilized(struct root_domain *rd) { } > > It should be > static inline int is_rd_overutilized(struct root_domain *rd) { return 0; } ok. > >> #endif >> >> /* Runqueue only has SCHED_IDLE tasks enqueued */ >> @@ -7974,7 +7984,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu) >> >> rcu_read_lock(); >>