Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp453984lqs; Tue, 5 Mar 2024 06:59:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWbAlwylGDH/ZMroeXniEHY8f9pfNH6bg4T8aWW30pfN/prUcO3DFCDgTZiaV4KbA+Du7gkZ8j1Kae2zKf5fOLYjkPz6pPC8o42GXd6yw== X-Google-Smtp-Source: AGHT+IEbkw7fGesrvWXQw8dgzvhUMDDh6GJBAbyCj3mGGHVWRcmZ0pCfpRJp7trXWFM0lZn5mxwu X-Received: by 2002:a05:6808:8c4:b0:3c0:b3f7:5678 with SMTP id k4-20020a05680808c400b003c0b3f75678mr1850767oij.35.1709650780976; Tue, 05 Mar 2024 06:59:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709650780; cv=pass; d=google.com; s=arc-20160816; b=lPAgWCi/ubzXAnM1PjW4GS6CLLvJ57CS1lDRR88gjy48WPiCOVGnrEpHt4SPy/8caJ EUt1maJZEU9dQxHYIlUARCQhijQEu/1C5kenn4vApNNsXsH67nzeiy1ZF4KPoFzI1/lX stEp62b7UdTJ6W9hv26sVnz5ZkxZ44ZMSnzbNlDEjs/RG9dU9iHDI0pffTdD3c/eJMXN 1VrOkl4B04OFlxd9CaahpyVk5MvLj4PLmLrE0egT0fsa3+VKqpcgoJTyI0uYg8JTdOpo 7SOQDvSTx+ZPVGXa2Xm1dWuSexluLJdLo/f8oZgJqm6L89MApjy3gbnlNcZjALR9fkGl fMEw== 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=gF8G3ruhGegqq982W60tv+nSJXALi85T8YtQmLiRDC0=; fh=0mi9Szkn7K6yCyW1qVNjlYCh2AEgORP6NMWmmSokHwM=; b=u2UxiVGqedsUlYYxWmeWw5x/Bhg66MA13AeYJniifO2bvOiuGx77lWl66DoFS3fStc tdrzttYimXdYwISrls5WKE4rP92L3hGMJ1aAP8H72It28NXebkNLKE8jXLBphOahBTQm NcyThD8lojSqG6IJFa1uuhIjVdSYHQfvrbhfVqIuPq3D5c4QB5/UeLATtZpaHv9124ok xIeVTR6zfgj6L2ejBRYmyoyvppCH8NdsPBEnTQABLNdrlpB3u9zvroAN1nOuZyVObizL xENtb38ywDZxzG+V3nhiAlEjlNipEwy3FKMXZTPpwhP9plFXJFnuRjDKNEy1vCqRvAqc u8/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QIBNQ7Xv; 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-92564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92564-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y67-20020a633246000000b005c66a3f3f5bsi10068877pgy.745.2024.03.05.06.59.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 06:59:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=QIBNQ7Xv; 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-92564-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92564-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id EEABD285F4C for ; Tue, 5 Mar 2024 14:59:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E66F7127B46; Tue, 5 Mar 2024 14:58:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="QIBNQ7Xv" 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 4D35E1272CC for ; Tue, 5 Mar 2024 14:58:47 +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=1709650729; cv=none; b=tmsPNu4ufr9zPO83lUCKyzre+FAEjw0abj1B3hOCDdSht8HDmpBMq07a6wT0UtK1SfjYdChmdEPTObnqoqvdbB4uiUNP62TTPlLwylMrnyldTmNYlcMajsNygqyKWKyIPxU1Oi5GKN3PJKuZqH+ZG7hfTSCx47OTxvxqPEzBuZQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709650729; c=relaxed/simple; bh=SEJR+owDaVd26AN4IDt/UWU4WTVRoD/qoP6NAHHjN6k=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Fc+i/NjBoYm1XOB7LziUnUtC1OMnOfdYuE9fuP9uEsBocekp4dFQee+k/0ScY2Iga+GNhWKn8mgNjsu3gJ7kTq76WfZi6s96s74PHJ4kkfmhnj7NsJW6EJtAjrXw4Ew41xmN9f5z2vPbz3/3TkheF7ExYQa5FjG5dGEHqTntwtA= 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=QIBNQ7Xv; 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 (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 425EwN7O029262; Tue, 5 Mar 2024 14:58:31 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=gF8G3ruhGegqq982W60tv+nSJXALi85T8YtQmLiRDC0=; b=QIBNQ7XvN8EpUp9x+tE5jj6jC5LgivULSjwTU6KYimxMDlp02np1QnjHxoBnMH9LnSJs ina8p94YUFP5TiZLnjT+fuDe7U+t7gDOpbYCJ7ivOvNWLFKSoTAsZ3cDYq2fSMX6faLF /mvzayJOClT53ZxDtIQu+V2eUkpj75k16u3K8cyzp94U2l6KgPaMUYLZXpKKJGMfGb1w tiyqGSaSc/6PqCU7L4ATqowc3e6oaay1w0lx0+AJ3vFgZPpxkUIOlqKSenTYEiMz8xaY oGJU5cmm1NqbHE7xZE+12SJH51Tezvwxy5BOGO2TyV5Sv2Amh0rA88olcDsL4AWyMu8J +w== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wp560grue-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Mar 2024 14:58:30 +0000 Received: from m0353727.ppops.net (m0353727.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 425EfN1a004632; Tue, 5 Mar 2024 14:58:27 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wp560grpf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Mar 2024 14:58:25 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 425E38DZ020667; Tue, 5 Mar 2024 14:56:58 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([172.16.1.4]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wmfxkr36b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 05 Mar 2024 14:56:58 +0000 Received: from smtpav01.dal12v.mail.ibm.com (smtpav01.dal12v.mail.ibm.com [10.241.53.100]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 425Eut6050725196 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 5 Mar 2024 14:56:57 GMT Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 397F558059; Tue, 5 Mar 2024 14:56:55 +0000 (GMT) Received: from smtpav01.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E08CF58058; Tue, 5 Mar 2024 14:56:50 +0000 (GMT) Received: from [9.43.117.244] (unknown [9.43.117.244]) by smtpav01.dal12v.mail.ibm.com (Postfix) with ESMTP; Tue, 5 Mar 2024 14:56:50 +0000 (GMT) Message-ID: <6ccd425f-7c02-4ede-9321-1e8154d5d470@linux.ibm.com> Date: Tue, 5 Mar 2024 20:26:49 +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 1/2] sched/fair: Add EAS checks before updating overutilized Content-Language: en-US To: Qais Yousef Cc: dietmar.eggemann@arm.com, pierre.gondois@arm.com, mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, yu.c.chen@intel.com, linux-kernel@vger.kernel.org, nysal@linux.ibm.com, aboorvad@linux.ibm.com, srikar@linux.ibm.com, vschneid@redhat.com, morten.rasmussen@arm.com References: <20240301151725.874604-1-sshegde@linux.ibm.com> <20240301151725.874604-2-sshegde@linux.ibm.com> <20240303185059.wvjkrrn7liwl4wtv@airbuntu> <5c6259a2-fadd-41c6-aa41-91f3af01272c@linux.ibm.com> <20240305102318.6qfib44f2ciffomw@airbuntu> From: Shrikanth Hegde In-Reply-To: <20240305102318.6qfib44f2ciffomw@airbuntu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: Tpq11kbzyt4YjhiQAIvXN8aHQH6weq5e X-Proofpoint-ORIG-GUID: M2-t9Hh1ljZXV3XH9BxYEKV_xVOhCshl 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 suspectscore=0 impostorscore=0 mlxscore=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 mlxlogscore=999 lowpriorityscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403050119 On 3/5/24 3:53 PM, Qais Yousef wrote: > On 03/04/24 13:54, Shrikanth Hegde wrote: >> >> >> On 3/4/24 12:20 AM, Qais Yousef wrote: >>> On 03/01/24 20:47, Shrikanth Hegde wrote: >>>> Overutilized field of root domain is only used for EAS(energy aware scheduler) >> >> [...] >> >> >> Hi Qais, Thanks for taking a look. >> >>>> --- >>>> kernel/sched/fair.c | 49 +++++++++++++++++++++++++++------------------ >>>> 1 file changed, 30 insertions(+), 19 deletions(-) >>>> >>>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >>>> index 6a16129f9a5c..a71f8a1506e4 100644 >>>> --- a/kernel/sched/fair.c >>>> +++ b/kernel/sched/fair.c >>>> @@ -6670,15 +6670,29 @@ static inline bool cpu_overutilized(int cpu) >>>> return !util_fits_cpu(cpu_util_cfs(cpu), rq_util_min, rq_util_max, cpu); >>>> } >>>> >>>> -static inline void update_overutilized_status(struct rq *rq) >>>> +static inline void set_rd_overutilized_status(struct root_domain *rd, >>>> + unsigned int status) >>>> { >>>> - if (!READ_ONCE(rq->rd->overutilized) && cpu_overutilized(rq->cpu)) { >>>> - WRITE_ONCE(rq->rd->overutilized, SG_OVERUTILIZED); >>>> - trace_sched_overutilized_tp(rq->rd, SG_OVERUTILIZED); >>>> - } >>> >>> Can we add >>> >>> if (!sched_energy_enabled()) >>> return; >> >> This is very close to what i had till v2. But it was pointed out that, it >> would end up calling sched_energy_enabled twice in check_update_overutilized_status. > > It's a static key. It will either patch the code to be a NOP and return, or > work normally. I don't see a problem. Yes. That's what i thought initially as well. It does make the code simpler. I will change it to use similar to what i had in v2 in next version. I will wait for a while to hear any issues with that. > >> In check_update_overutilized_status, it would be better to avoid access to >> overutilized and computing cpu_overutilized if EAS is not enabled. > > cpu_overutilized() could gain a protection with sched_energy_enabled() too. > I think it's better to encapsulate the deps within the function. > ok. let me try to incorporate that. >> >> I am okay with either code. keeping sched_energy_enabled in set_rd_overutilized_status >> would be less code and more readable. But would call sched_energy_enabled twice. >> >> Dietmar, Pierre, >> Could you please provide your inputs here? > > I prefer not sprinkling sched_energy_enabled() for every user. But FWIW the > code looks correct to me and these stylistic issues are not a blocker for me > > Reviewed-by: Qais Yousef > >> Thank you. >>