From mboxrd@z Thu Jan 1 00:00:00 1970 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 CD06937646E for ; Wed, 17 Jun 2026 17:43:52 +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=1781718234; cv=none; b=WuAKEakQGN9XyTGXULdewSR1FUlkKFFJQNWL2S6a2vb0fVPfpAMV8BIkzfvhmn3ftvMRAGNLUC505G4KTCFgfCl/qZhHLUZKLqEo4OtrXBrcQhj3hA69Ee3O9tF6iByGijZbxVJRdaRZMhZfbQctx7r/a/UHkP4BwtLBP08sYKs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781718234; c=relaxed/simple; bh=ez+WZcYjyksUYRQLAEJowH+FuSMMVb9IQXIIjnujB1k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CpyMFMB3mCnBtsMY3oGOill8SRYof8shImkwbBczC133QRTPvPUCKFrLFYHxoCEMVzLRtw7hDknRt6CPeWWkuwI2BvyTO6glDARXMO4jzr9VwlXOEG9FQaq6JhwSBXE6cibX4hYqNvSm1RREyZAFWtHtTE38yA1kUBd+zpQ1yuk= 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=kw7xtIvf; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="kw7xtIvf" Received: from pps.filterd (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65HFph37744343; Wed, 17 Jun 2026 17:43:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=pp1; bh=rhsB9KaLXVGyRHN7D rlsbO3VQOHZX9Xo6huZTux0/RM=; b=kw7xtIvfw/KQM08FPX5xSpsgVqcQ+osTP frqnsItVTaroZIf0oyLMN51ZWTeE/2/sa/B1HC7TevSHB/4u0zWfa574zi0mtR2/ jtvDXkxDIScrHlm26ff/sa4TXDnLlGkZDMlCZNaQ3dDvaeSOaG6QWPxRgff4wznl wwjlsw0BRlstu8IJNGGjeHhNH7sKS7830YgjfWrDtgbNv9L77HbJTvXqKdi4CuEX 4DeVIGUj351qr6Zec35f0gY784VXOTccV5ZJPYUs4GXmAehADl7XRDm5NzsRkFXj YMOmpEr9A38Oukr1ynOvX81ptMrsFIl++XamNSSQDSdN1qW5G+qYg== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4eueqx4772-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jun 2026 17:43:35 +0000 (GMT) Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 65HHYger013009; Wed, 17 Jun 2026 17:43:34 GMT Received: from smtprelay05.fra02v.mail.ibm.com ([9.218.2.225]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 4eudva4chs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 17 Jun 2026 17:43:34 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay05.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 65HHhUvs49611012 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 17 Jun 2026 17:43:30 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C368B20049; Wed, 17 Jun 2026 17:43:30 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 949AB20040; Wed, 17 Jun 2026 17:43:23 +0000 (GMT) Received: from li-7bb28a4c-2dab-11b2-a85c-887b5c60d769.ibm.com.com (unknown [9.39.28.77]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 17 Jun 2026 17:43:23 +0000 (GMT) From: Shrikanth Hegde To: linux-kernel@vger.kernel.org, mingo@kernel.org, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, yury.norov@gmail.com, kprateek.nayak@amd.com, iii@linux.ibm.com Cc: sshegde@linux.ibm.com, tglx@kernel.org, gregkh@linuxfoundation.org, pbonzini@redhat.com, seanjc@google.com, vschneid@redhat.com, huschle@linux.ibm.com, rostedt@goodmis.org, dietmar.eggemann@arm.com, mgorman@suse.de, bsegall@google.com, maddy@linux.ibm.com, srikar@linux.ibm.com, hdanton@sina.com, chleroy@kernel.org, vineeth@bitbyteword.org, frederic@kernel.org, arighi@nvidia.com, pauld@redhat.com, christian.loehle@arm.com, tj@kernel.org, tommaso.cucinotta@gmail.com, maz@kernel.org, rafael@kernel.org Subject: [PATCH v4 08/20] sched/fair: load balance only among preferred CPUs Date: Wed, 17 Jun 2026 23:11:27 +0530 Message-ID: <20260617174139.155540-9-sshegde@linux.ibm.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260617174139.155540-1-sshegde@linux.ibm.com> References: <20260617174139.155540-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-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjE3MDE2NiBTYWx0ZWRfX81157hx5Kzih Etivf/2auF3QMz9Psyu4J1Xd5EezYH3zsLhfzp9NkUuo7wjkPu/8tkHNsEKTDQqdytLdaldD3Na jo+DRGT918nBEho5IOc9GQnEMlfP//AcVfqeUH4Ufgc3s8PATtVSm//GbgdkkWn+m6ZSvboeSiy 8eyCq0TGuPCmOstk9/BfECSGR3/HRhovufAHVRxOZcJm2S7VHVfpi+qkZqYUbrpOPqE5A22TiUF Q2aDxurC/ZwttdEJxhrSwlHKnUnsrM89owuCv/wDX5358duGg3d2/jplwssjuh1qbWEdD4rL2/f xcJ4HSf61bJ5C9WikzQzb1JABEuKszD+PiUOJVMq0uMTaOR5hMvF2bUljCjAZMVt3+62S9rMSMX MbE6bBMby8cNZUa6gh+0h3fzQZq2I3tzBb4ddBm9BxQCVHyQM6v6vVWXE5fkZa0uP7sWmYAb0aa d8G+jAW68jOuXph9D6g== X-Proofpoint-GUID: 2knXGPZcigwetaeWFz_weIv-M3GEEh7T X-Proofpoint-Spam-Info: AW1haW4tMjYwNjE3MDE2NiBTYWx0ZWRfXxiVnc7sBHdTr +nP+npI9BV15xo6LnP/6ItJVL2Uclv3twOYURYCKAXeiF7ZF9Fr/iBhPQxy9nJboyb5Oh9Tu4ja 0nDpgMTWlxFlLdN60w1e6Y7Pfa7Zff8= X-Proofpoint-ORIG-GUID: XFLtB6whorR-_jH5y1DGecmO2Nqas9RB X-Authority-Analysis: v=2.4 cv=auGCzyZV c=1 sm=1 tr=0 ts=6a32dcc7 cx=c_pps a=bLidbwmWQ0KltjZqbj+ezA==:117 a=bLidbwmWQ0KltjZqbj+ezA==:17 a=FelO9ux0wxsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=Y2IxJ9c9Rs8Kov3niI8_:22 a=VnNF1IyMAAAA:8 a=5ICBfrR2l7P1yX5hQRsA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-17_02,2026-06-17_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1015 priorityscore=1501 suspectscore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 adultscore=0 malwarescore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606170166 Consider only preferred CPUs for load balance. With this, load balance will end up choosing a preferred CPUs for pull. This makes it not fight against the push task mechanism which happens at tick. Also, this stops active balance to happen on non-preferred CPU pulling the load. This means there is no load balancing if the task is pinned only to non-preferred CPUs. They will continue to run where they were previously running before the CPUs was marked as non-preferred. Signed-off-by: Shrikanth Hegde --- kernel/sched/fair.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d78467ec6ee1..3f3c7f0ca489 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -13291,6 +13291,9 @@ static int sched_balance_rq(int this_cpu, struct rq *this_rq, cpumask_and(cpus, sched_domain_span(sd), cpu_active_mask); + /* Spread load among preferred CPUs */ + cpumask_and(cpus, cpus, cpu_preferred_mask); + schedstat_inc(sd->lb_count[idle]); redo: -- 2.47.3