From nobody Tue Dec 2 02:29:44 2025 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 D785C3195E5 for ; Wed, 19 Nov 2025 06:22: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=1763533347; cv=none; b=dpN1q2S/EwxtomjDT6cy+ZILujQX1lkBYJTj4DNW4elUeHsvsrYAdSPkCY8FGDPuPSIdlbI8N3fuien9Sq0Limi/xXM8nyNzNkbr12hPyEok8cwM6jgilZUN9ZckEIxklYvk261vsc9HJh3QzPoe6z25QULzhKy8bW5GN+YYACA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763533347; c=relaxed/simple; bh=5pg8FXk9AUO27t5++d0kJpKvZPSgzngRzpsBOTqx4bI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tEr1x5TIEv2j23QjP7ZXOieuoRwYjDtyZ6RGze+N9cpe8y91AglM96FP5DRe891iQgwm/J6fYsD4v3lZtEH5mbtjZZEjAEyFnipUWjhyiZQHL4FTYCdhPVbfgdY+9LSgnCWr1UmYxjYUWVtu7FOQepkv0IjhbMx9Y2LR5MY44mM= 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=rSUmTUir; 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="rSUmTUir" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5AIGptgL025875; Wed, 19 Nov 2025 06:22:02 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=f8yijGd0trpyn0GQZ dp9BNJ2l8xqlvD2qF4ywKOsS40=; b=rSUmTUirwQkTIoF+neJh7VjILC+Bpwk/A tN9P5oKjhsdJpr/m+Ppz4SCxt6EEAV4mEJXe2hTc4FnWJvIxCVj99oFO0p9yvNhU 3rK69UsKo89FVh9M3jg3lEZtpHXNMwQVoE2n0qtGo1ds+P+mnnjZJR1S2VFDuliY 25s9i8cEwJ6PXu2NASbveY2sh4XYahKMzeCxC5BZbGXJlJRg2E7CgGVkQMd2rAnD S1isxanjPhG9FM4c/g+3NoGYFzk6Th+6ILUlfu92Rr2ytsXLNFrfteALxQhdCQm/ UXU7CAhSnEFAiSI27JPGIZ/BVA0wlFodFceghMsoL62pj2RsSOs1Q== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4aejjtx552-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Nov 2025 06:22:01 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 5AJ6M1Eh032604; Wed, 19 Nov 2025 06:22:01 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4aejjtx54y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Nov 2025 06:22:01 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5AJ2lxYv030791; Wed, 19 Nov 2025 06:22:00 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4af47xy927-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Nov 2025 06:22:00 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5AJ6Luwq23134852 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Nov 2025 06:21:56 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 66C7220043; Wed, 19 Nov 2025 06:21:56 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 678EC20040; Wed, 19 Nov 2025 06:21:52 +0000 (GMT) Received: from li-7bb28a4c-2dab-11b2-a85c-887b5c60d769.ibm.com.com (unknown [9.39.25.220]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 19 Nov 2025 06:21:52 +0000 (GMT) From: Shrikanth Hegde To: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: sshegde@linux.ibm.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, tglx@linutronix.de, yury.norov@gmail.com, maddy@linux.ibm.com, srikar@linux.ibm.com, gregkh@linuxfoundation.org, pbonzini@redhat.com, seanjc@google.com, kprateek.nayak@amd.com, vschneid@redhat.com, iii@linux.ibm.com, huschle@linux.ibm.com, rostedt@goodmis.org, dietmar.eggemann@arm.com, christophe.leroy@csgroup.eu Subject: [RFC PATCH v4 06/17] sched/fair: Pass current cpu in select_idle_sibling Date: Wed, 19 Nov 2025 11:50:49 +0530 Message-ID: <20251119062100.1112520-7-sshegde@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251119062100.1112520-1-sshegde@linux.ibm.com> References: <20251119062100.1112520-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: quoted-printable X-TM-AS-GCONF: 00 X-Proofpoint-GUID: PrOkUxaqOlOHFsjN3g62TBwDejMTEiDX X-Proofpoint-ORIG-GUID: DTGLePjwWXwpfo3xylAp3_fkws5dHnxw X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE1MDAzMiBTYWx0ZWRfX98HpljThVV0W EqT6vhVl8DEoLO9LVbkP25gY9L0EtroIoPa4JhocW23DzOqBEz1lxB6YfEZ+474SCnbhyaKfBh/ BPPUn+upsqReJpYNFj9l3jJC0KJMKd5u3N/tBvYtdsANcJi3kDsqMMHg/PMYQTsqiPrVGF3RC7n QRWvRKdT6XeQyqGJ9yo+0mgJSVnpyrZXXxnLcwF/IReAbmEd5g4ouqAB2UthNScVZzY+O5nHjzj ZhTjpBbGExjW/6aAUg7GENHVdNNGUn9IFjI4MDEZATqXD/GWolS5Kkk2D4TW260U63FsBMe2Whl X3GY9R6i8xLlAIIiMG8Y+4l2xv1pgCujFcap6a9wYQofiAoEaTD+lm5djoPfwY8xXlFW8HhdKOq blqq2ssCOGKG+QaDYGjIcXj68ob1FQ== X-Authority-Analysis: v=2.4 cv=SvOdKfO0 c=1 sm=1 tr=0 ts=691d6209 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=LR1EqIGjcEKtFJDgD-kA:9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2025-11-19_01,2025-11-18_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 clxscore=1015 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 impostorscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2511150032 Content-Type: text/plain; charset="utf-8" Pattern in select_task_rq_fair: cpu =3D smp_processor_id(); new_cpu =3D prev_cpu; //May change new_cpu due to wake_affine, otherwise it remains prev_cpu new_cpu =3D select_idle_sibling(p, prev_cpu, new_cpu); Due to this often prev_cpu =3D=3D new_cpu. If the task was sleeping when the prev_cpu was marked as paravirt, it would be beneficial to choose curre= nt cpu instead. If the current cpu is paravirt too, then wakeup will happen th= ere and at next tick task will move out. So pass current CPU as well in the select_idle_sibling. Signed-off-by: Shrikanth Hegde --- kernel/sched/fair.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 1855975b8248..015e00b370c9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -1048,7 +1048,7 @@ static bool update_deadline(struct cfs_rq *cfs_rq, st= ruct sched_entity *se) =20 #include "pelt.h" =20 -static int select_idle_sibling(struct task_struct *p, int prev_cpu, int cp= u); +static int select_idle_sibling(struct task_struct *p, int this_cpu, int pr= ev, int target); static unsigned long task_h_load(struct task_struct *p); static unsigned long capacity_of(int cpu); =20 @@ -7770,7 +7770,7 @@ static inline bool asym_fits_cpu(unsigned long util, /* * Try and locate an idle core/thread in the LLC cache domain. */ -static int select_idle_sibling(struct task_struct *p, int prev, int target) +static int select_idle_sibling(struct task_struct *p, int this_cpu, int pr= ev, int target) { bool has_idle_core =3D false; struct sched_domain *sd; @@ -8578,7 +8578,7 @@ select_task_rq_fair(struct task_struct *p, int prev_c= pu, int wake_flags) new_cpu =3D sched_balance_find_dst_cpu(sd, p, cpu, prev_cpu, sd_flag); } else if (wake_flags & WF_TTWU) { /* XXX always ? */ /* Fast path */ - new_cpu =3D select_idle_sibling(p, prev_cpu, new_cpu); + new_cpu =3D select_idle_sibling(p, cpu, prev_cpu, new_cpu); } rcu_read_unlock(); =20 --=20 2.47.3