Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp182457lqg; Fri, 1 Mar 2024 01:48:34 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWCI5+9HEnDuRe32kanIHqh81me0Bz1kf7N3kcLpcj14tCU50RIVDZ8cKHx2/7fu2tdFpoeFzPMF6RwQmNjs0seuD2+MphaKjb+lfGKSw== X-Google-Smtp-Source: AGHT+IE6Ger1t75vYSZjNnKNmj7/E1xi4rXefHkGFIkqZdirMz9FGi+m/23cXQNGIok2gyfyD8Dq X-Received: by 2002:a05:6a20:e121:b0:1a0:e9ad:7f29 with SMTP id kr33-20020a056a20e12100b001a0e9ad7f29mr1148758pzb.6.1709286514266; Fri, 01 Mar 2024 01:48:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709286514; cv=pass; d=google.com; s=arc-20160816; b=Yzo7ZXDvWm35wbBGwmJDJHc0i2vBqthN3TqdWvgmNmv7FVw05zsOowe9qC0NOmP3i0 RMdt0xlSnJzFhLJoXvla1+iLj6LGp/CSNY4bhHtttvip4QeaJx6l1SJBW7jLQhmF1ypQ eJujV2Mmi/LqFf84VaRDPB5x7QLO5MBN73GtXmOg6VTqO0uETwDHCHbgb0hhX+bzXxov wT2nTRb5k1+EgPr14Dqj00c3w0d3+zdnVGPCxorZukJ2crpDu3LeEcVNs88GK5NpEtEr r8nxZWy+Akqm5gYdj7ZaukDGunvDvd5zzJYn9nW0Q6XyeK3/KX/xFcdeb8SfX9gJ1p19 O1Ow== 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:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=bQHgKVrBps8F4ZTJ72KaBlIvOaPrhJSEKrvDGJ2dDIw=; fh=EFGWqjdjv3ZMBDpDG6Hq3Go55qz3kYzuVuNFCxe+jxw=; b=uK0OCkYbI0ThGzM4YU7M3eCvJJ+mbcXj7A4Jpr7fxGactfoPFeHAkVIFhhYR0oaE9P XCUCKFtWC2YjeVlPhbqo5HkXhavL0Qxt/KgCLwnOZWwpY9kX6j9c7JtuuLrI8VhjZL1m wgI6l0POOmUZIUOGAehPLLaaXW3dXys9Q91h+1igtCli+opcIlXhKPRMz5hCbi7e5PDw Bs3sx+EhqJ3pMkdQbHYvGHylr9lk5WyAD5hbYvgbFg1JoQIMORvghrz2U0k7U1y5bwB5 UGo5Xd0tbayKIEl47xLYz43ldD1PGO258HXy9/KkADrIKfFA2RzqBKg2/7L2/rdolLug leKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=S2bHFfW+; 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-88201-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88201-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. [139.178.88.99]) by mx.google.com with ESMTPS id lw8-20020a17090b180800b00299738570a7si5612969pjb.89.2024.03.01.01.48.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 01:48:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-88201-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=S2bHFfW+; 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-88201-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-88201-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 EC355283DBD for ; Fri, 1 Mar 2024 09:48:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3FF1D6A8BB; Fri, 1 Mar 2024 09:48:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="S2bHFfW+" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 6EE141E4BD for ; Fri, 1 Mar 2024 09:48:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709286508; cv=none; b=DhtNqn95DL1AHAYaAZ1kCEQZYhj46rc6wx0I3KC84/nlC7FzPZHU0qpqpyn/VhoLGEefj4D5wAhJb7NJAtN8qMZ7IFoEn2I6Q0TkVjPxEO1vnPxxG9bkPCuJ2S66X7ucvm8fM4HL2HRoUaRF4CNa0Cm6ybU08WnN3qAmKx3HvB0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709286508; c=relaxed/simple; bh=zfr2/Z4XDDvKRxaran7leIT1e/JMlRwrHfuX/mcUawE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Luopc2C3cWsqRxarbplMUKJkYbvlkwAidGYyXJJkuUI0KaUvWa+rDVWgl9dR75+71i5TlDq6kjz3kzRNYFzko/lJUnbLOj/zD4aLUwuwa32TVKzM+f89JPz06766OxplF+4ITrUJnYhadECeFWCTach2KZxrDDJCVHCMJyU+C2g= 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=S2bHFfW+; arc=none smtp.client-ip=148.163.158.5 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 (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4219RbFl019260; Fri, 1 Mar 2024 09:48:11 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=date : from : to : cc : subject : message-id : reply-to : references : mime-version : content-type : in-reply-to; s=pp1; bh=bQHgKVrBps8F4ZTJ72KaBlIvOaPrhJSEKrvDGJ2dDIw=; b=S2bHFfW+pI6fncYQdpehLXKze7VXgbIEpQ6yc+DmcU7JwASz9+pHizpSCCVowDaV0GPN U9Fx9F7gv1JRFs7DCgponu9gmhfyBJVCJKkP6Vhetl3tHyY02V+SHgZAbjpbEry8zA3E YmkGsNa6NkNKt7H8bnzNMftZQWeRTi1IkFV1UMCDTJg6Ufb3qIcqdHIzLEgny63NxpxP kYJfMrxzxYFqQqvazFPV8f9QRUDhrq2+MO63U3eftw4+INBHlosGhom6uSaFXHywBlO6 EW8BVvRSxOThSLxcDOK9aIoLCVnpL0EsfrCAFzr8mhc3qF8kBuy9a6ZhuzFDjYTiFki7 RQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wkcderj76-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Mar 2024 09:48:10 +0000 Received: from m0356516.ppops.net (m0356516.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 4219lGU8031973; Fri, 1 Mar 2024 09:48:10 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 3wkcderj57-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Mar 2024 09:48:10 +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 4216X6CJ008211; Fri, 1 Mar 2024 09:26:44 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wfv9mu98s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Mar 2024 09:26:43 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4219QckC23921392 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Mar 2024 09:26:40 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4122D20043; Fri, 1 Mar 2024 09:26:38 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4859820040; Fri, 1 Mar 2024 09:26:35 +0000 (GMT) Received: from linux.vnet.ibm.com (unknown [9.126.150.29]) by smtpav05.fra02v.mail.ibm.com (Postfix) with SMTP; Fri, 1 Mar 2024 09:26:35 +0000 (GMT) Date: Fri, 1 Mar 2024 14:56:34 +0530 From: Srikar Dronamraju To: Shrikanth Hegde Cc: mingo@kernel.org, peterz@infradead.org, vincent.guittot@linaro.org, yu.c.chen@intel.com, dietmar.eggemann@arm.com, linux-kernel@vger.kernel.org, nysal@linux.ibm.com, aboorvad@linux.ibm.com, vschneid@redhat.com, pierre.gondois@arm.com, morten.rasmussen@arm.com, qyousef@layalina.io Subject: Re: [PATCH v3 1/2] sched/fair: Add EAS checks before updating overutilized Message-ID: <20240301092634.GA826313@linux.vnet.ibm.com> Reply-To: Srikar Dronamraju References: <20240229104010.747411-1-sshegde@linux.ibm.com> <20240229104010.747411-2-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=iso-8859-1 Content-Disposition: inline In-Reply-To: <20240229104010.747411-2-sshegde@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 0pi7lsYlI7UA7qBOqIvqvCNlVBwcCxqx X-Proofpoint-ORIG-GUID: 6-7toBEoOt6Ge1I9Jekxg8_jUXVlY332 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-01_05,2024-03-01_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 suspectscore=0 bulkscore=0 phishscore=0 priorityscore=1501 impostorscore=0 mlxscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 spamscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403010082 * Shrikanth Hegde [2024-02-29 16:10:09]: > Overutilized field of root domain is only used for EAS(energy aware scheduler) > to decide whether to do load balance or not. It is not used if EAS > not possible. > > Currently enqueue_task_fair and task_tick_fair accesses, sometime updates > this field. In update_sd_lb_stats it is updated often. This causes cache > contention due to true sharing and burns a lot of cycles. overload and > overutilized are part of the same cacheline. Updating it often invalidates > the cacheline. That causes access to overload to slow down due to > false sharing. Hence add EAS check before accessing/updating this field. > EAS check is optimized at compile time or it is a static branch. > Hence it shouldn't cost much. > > With the patch, both enqueue_task_fair and newidle_balance don't show > up as hot routines in perf profile. > > 6.8-rc4: > 7.18% swapper [kernel.vmlinux] [k] enqueue_task_fair > 6.78% s [kernel.vmlinux] [k] newidle_balance > +patch: > 0.14% swapper [kernel.vmlinux] [k] enqueue_task_fair > 0.00% swapper [kernel.vmlinux] [k] newidle_balance > > Minor change: trace_sched_overutilized_tp expect that second argument to > be bool. So do a int to bool conversion for that. > > Fixes: 2802bf3cd936 ("sched/fair: Add over-utilization/tipping point indicator") > Signed-off-by: Shrikanth Hegde Looks good to me. Reviewed-by: Srikar Dronamraju -- Thanks and Regards Srikar Dronamraju