From nobody Tue Dec 2 02:29:42 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 C9F8435BDB5 for ; Wed, 19 Nov 2025 12:45:48 +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=1763556351; cv=none; b=JPkREGdHe1N+ruUlbOGJy//3ecdR9Vui/4WdmqD89SiDOQyLlyyieBpql1lLHX1Jh8S7l7QGiZc3a6laRPeEVgePHqLNy9E1obpuw5KuTBUdIeSGzQwecoxQKZ7O21cDHJvZKsXA2xA9n76J586XcijxRfIdLESgSD+Lv3e8WQI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763556351; c=relaxed/simple; bh=5pg8FXk9AUO27t5++d0kJpKvZPSgzngRzpsBOTqx4bI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F97iG9msECql1EsaPemhuhzn34hGiAKAp4qKZXPSXQGfZQ5T4Dv+FuIgmJFg0gNN534Sz/VZGsPe/AA4kYTlBamxnAo00LycLNDMbRsOz1WyE8QpvyZuRGsEWYaR3qCj+sMaqUstagkohHyEP1I9z32f/4EtqlbmVOv3p+rYaA8= 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=S7i/hO6e; 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="S7i/hO6e" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5AJ7HIxu019349; Wed, 19 Nov 2025 12:45:30 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=S7i/hO6eJtGFtRilYEFG7LlCTzdMZryGQ 5TzemsU8f1A5ZXaRWbt38ph4Vb3mCUgVc4KB5iCpSR/MwjopVFLFRLCmDyLaY8oY 55WUt7ZKk6Dxy7VHwBn1oAMwtermaRIHSIthBLRZGB8IPxY1lAYpMrie0KOyyyIk hO9WVkKW16DTAc5LlFS1gKgsvU8wMGWIWt4oHwyFy6iAie+4dCMbZt1mSke7mlqh SP4i1JYJviAxMfPak0IGPmdad7hdtO8tGCTCb9c23+ep6XkY5LkIWth36kOcc7vn KeVySuRMI+B6VHnaXouIOoomrJgSOanWkedVC13vj5FYs1BRrnKvQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4aejmsqntj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Nov 2025 12:45:30 +0000 (GMT) Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 5AJCdmaZ018424; Wed, 19 Nov 2025 12:45:29 GMT Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4aejmsqnte-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Nov 2025 12:45:29 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5AJCHdw8017319; Wed, 19 Nov 2025 12:45:28 GMT Received: from smtprelay02.fra02v.mail.ibm.com ([9.218.2.226]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4af6j1rcc2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 19 Nov 2025 12:45:28 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay02.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5AJCjOmu52953530 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 19 Nov 2025 12:45:25 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D780E20043; Wed, 19 Nov 2025 12:45:24 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B23E420040; Wed, 19 Nov 2025 12:45:20 +0000 (GMT) Received: from li-7bb28a4c-2dab-11b2-a85c-887b5c60d769.ibm.com.com (unknown [9.39.25.220]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 19 Nov 2025 12:45:20 +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: [PATCH 06/17] sched/fair: Pass current cpu in select_idle_sibling Date: Wed, 19 Nov 2025 18:14:38 +0530 Message-ID: <20251119124449.1149616-7-sshegde@linux.ibm.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251119124449.1149616-1-sshegde@linux.ibm.com> References: <20251119124449.1149616-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-ORIG-GUID: HAkR2ikVxu5ppvG9Ed_Za4Od8QKMpVeP X-Authority-Analysis: v=2.4 cv=Rv3I7SmK c=1 sm=1 tr=0 ts=691dbbea cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=6UeiqGixMTsA:10 a=VkNPw1HP01LnGYTKEx00:22 a=VnNF1IyMAAAA:8 a=LR1EqIGjcEKtFJDgD-kA:9 X-Proofpoint-GUID: pARDVr-xXswqWRaIiOxPaFZZUMaQYkp4 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMTE1MDAzMiBTYWx0ZWRfX0Qm17IMWwbLJ v8hZM/dV4NL8xBKpRBtWnHBFe6Zn3ob4/BKPmlEe0EuI6FgDFdX2xAAeroIBBdeJ29mfAMxv0AA sVCHtHVeSs1oC8n1Qim0kYNwLy1AQR6V0F3Ern8BSFv+Zjy0sMDtrd2HWH4HDnq55QV5nXX8jYt M4UR7IY/d1k3Pf0bEhTY+/ExQTlKZXRYeVbNQwr9fgRItEAoRXBMCht+PVFtbZAyrMOBPatcGaI RcPMH3rdQHiXKZjeI2AF0CgbA5cdNsQdYB9R3TQHqf0fiRQo1MFhmJ+lFcK+JZk1BvBn0YehOtu 19oxSJDrpvb9HDtikueMLajv2+Lj3MFfk0zh3POZa9xWlQwcGDDmUt8qvSkDREfeV0INTPgWL/4 N69X83IJ/LvRrWrvZyu+GfgivX37Hg== 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_03,2025-11-18_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 suspectscore=0 clxscore=1015 phishscore=0 priorityscore=1501 spamscore=0 lowpriorityscore=0 impostorscore=0 adultscore=0 bulkscore=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