From nobody Tue Sep 29 14:10:01 2026 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 043D3485CD6 for ; Thu, 6 Aug 2026 18:19:34 +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=1786040376; cv=none; b=tBpcopxNZX12MT4sbHde9buhogNyXyZDGgnQe6oZ+rt9H1OsjVf5n6ITXsx3jXL2wo2Y0vqNXkbmNJJ3aFQa86XeI3rHF/ijzhLun0c+p9EpTt6TAhKeFUArCCko5XfIjOAvNRWMK4jhtS8MASJ4CkfsdMdjXPIxfeIPZ879eV4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786040376; c=relaxed/simple; bh=ulVueGpmEO9PFoQPGrJKHRCd+QfWii/Xg3nLJ/S5Z9Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=V6Ckp6e57iutxMgsZvsLqr6UzyBcAFmqcdbcsCL3sKtvEFNTj7tx40keLsZSnRtQFJUCwaqzDamFLZSLdaMKxLqvIZZwnosQ5lZs+JZs83ayW7lSJ/CvN0qeUXM+LM32OJd7kUZ0JYAxxkkridmvuwewNc8x/+3NmHxEpfj2UFQ= 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=lF1dSwxe; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="lF1dSwxe" Received: from pps.filterd (m0353729.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 676IHoJR1535970; Thu, 6 Aug 2026 18:19:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pp1; bh=Za+c50cudgIxBtcmSioDxnvxC7L/ uNM2FhRL4dwdt/U=; b=lF1dSwxevuD4NNBZ+tScaYmJ7iIVW2LYhi7L2cJ6cOtD yGBUCqWCQRF41VXj7r9HM2eG6Wt7f0gEUih2Q0hT/d0R5dCA2O5NTDVulF/STQjR 7FiXz35/5T+hNTbkFawFh710Jot2MiNQKqoorXQ8JXCl4qAAZJe8cTpP08P5w35n On5HhX7vyGsQm+Ahx2EGpjioWoW0EbOYxDwn45u3Srs1vGtCIMMEJInosZNm/Axu JSWLuCasAcI3pRCm5ezUST5rdvqj8iUvaL0LDzWQQT/QozQDKtGwHf4CbNo1eHRj xAPPkLi6uISScOFOU210BDXHO9LhJaK82Cy6dEUhJw== 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 4fvy01g4t9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Aug 2026 18:19:01 +0000 (GMT) Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 676IHf7Q008401; Thu, 6 Aug 2026 18:19:00 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 4fswtyv6d5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 06 Aug 2026 18:19:00 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 676IIucb28901696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 6 Aug 2026 18:18:56 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9BF6B20043; Thu, 6 Aug 2026 18:18:56 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3AE7920040; Thu, 6 Aug 2026 18:18:56 +0000 (GMT) Received: from [192.168.2.127] (unknown [9.111.18.123]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 6 Aug 2026 18:18:56 +0000 (GMT) From: Mete Durlu Date: Thu, 06 Aug 2026 20:18:56 +0200 Subject: [PATCH] sched/fair: Make is_core_idle() check all cpus in a core 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-fix_is_core_idle-v1-1-605119e55b25@linux.ibm.com> X-B4-Tracking: v=1; b=H4sIAAAAAAAC/2WNQQqDMBREryJ/3YhJUGNXvUcRiclP/aBGklYs4 t2b2mWXb5h5s0PEQBjhmu0QcKVIfk7ALxmYQc8PZGQTgyhEVdSSM0dbR7EzPmBHdkQmndSNFX3 jUEOaLQFT51Te28QDxacP7/Nh5d/0J1NF+S9bOeNMoVNNKS1WtbmNNL+2nPopN36C9jiOD5BUF Wi0AAAA X-Change-ID: 20260731-fix_is_core_idle-3f3a9d2b9fea To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak Cc: Ilya Leoshkevich , linux-kernel@vger.kernel.org, Mete Durlu X-Mailer: b4 0.14.3 X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: OKEkOs7QqHwmDjqnd9kk9Y4FnnQcn1FH X-Proofpoint-Spam-Info: AW1haW4tMjYwODA2MDE0MyBTYWx0ZWRfXyOuWr9L8RnLI Sx1TL83hh5GXhyRBsxKtfdRCFyiw9B1ewMuijKw+1MSCeAHeDf9VVRB+vwaA71b8Xh1n8iMbUMe n8GgeF3qejZNom6LLgUUo4j4sdIklqw= X-Proofpoint-ORIG-GUID: 0ek0IfrABPMPLbt2QNASYER8uIXt2DhR X-Authority-Analysis: v=2.4 cv=afNRWxot c=1 sm=1 tr=0 ts=6a74d016 cx=c_pps a=aDMHemPKRhS1OARIsFnwRA==:117 a=aDMHemPKRhS1OARIsFnwRA==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VnNF1IyMAAAA:8 a=Vy2CFEd9bMhl7QSrL4oA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODA2MDE0MyBTYWx0ZWRfXyPhem8SlNkDJ 6kt5FLEx9cqra/a2d4ZRgb3D5EttosST0JmQX3uwX9LD22xqwItdq6I9gYxIhHicX8tu3tTVcg5 JarF+ngvrSRR3wb44egIjp8Amv7mAGYwWMp+VFV5aSY2txi1d5rlnjo5X4obZHdhL2ottj71+vb s6a13T66rvn6cj4ZY5iYkN0IZlxCarG+5pPNG4acbwb5GfYcK7948StQWAVzKhd2qBTWVv41nQN VXm/8hfRMPUEf80QTf2jPWbijXfwa35L+7FnlmSI/KDRypJ53M2Z8dA03K1GBjpPcdPYlKg2vaN Am+47mrhu/kHMEurdnpSqARODaFi2UZUb6yRR3vABLltoV6rhS/KEBVAmgBNNKJ/24SAxVZYoxx VzpFutydJJCR0K+8/d7KIT5QgRbTxFDCL6Byku4Aublc617O87kxcTyFOvZrMM+xL4ECOUAvORF q6p8bp3piubmO5xL8fg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-08-06_02,2026-08-06_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 phishscore=0 impostorscore=0 adultscore=0 suspectscore=0 bulkscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608060143 The is_core_idle() function has a misleading name and incorrect behavior. Despite its name suggesting it checks if a core is idle, it actually skips checking whether the passed CPU itself is idle. This leads to incorrect results and has caused confusion among users who assume the function works as its name implies. Fix this by removing the check that skips the passed CPU when evaluating idle_cpu(), ensuring is_core_idle() now correctly determines if the entire core (including the passed CPU) is idle. Signed-off-by: Mete Durlu --- is_core_idle() does not really check if the whole core is idle or not. Despite its name suggesting it checks if a core is idle, it skips checking whether the passed CPU itself is idle or not. This is misleading and can lead to incorrect results and assumptions. Initially introduced by ff7db0bf24db ("sched/numa: Prefer using an idle CPU as a migration target instead of comparing tasks") as a numa only function, is_core_idle() was used along a idle_cpu() call. But after being moved out from numa code to common code at 8b36d07f1d63 ("sched/fair: Move is_core_idle() out of CONFIG_NUMA") new users started to appear. As the name is misleading, some omitted the prerequired idle_cpu() check for the CPU passed to is_core_idle() and wrongly assumed the whole core being idle. Fix this by removing the check for skipping the passed CPU when evaluating for idle_cpu() on core siblings. This could be leading to performance regressions on smt systems but s390 doesn't seem to be showing any impact. None of the benchmarks show any notable change. On a 8 core (smt 2) system run; * stress-ng -M -b 5000000 -t 45 -c 8 --cpu-method int64 * perf bench --format=3D"simple" sched pipe -l 1000000 * hackbench -T -p -l 160000 -g 2 --- kernel/sched/fair.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d78467ec6ee1..361efd3015e1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2162,9 +2162,6 @@ static inline bool is_core_idle(int cpu) int sibling; =20 for_each_cpu(sibling, cpu_smt_mask(cpu)) { - if (cpu =3D=3D sibling) - continue; - if (!idle_cpu(sibling)) return false; } --- base-commit: 8ba098e6b6ff0db8edf28528d1552be261af30d4 change-id: 20260731-fix_is_core_idle-3f3a9d2b9fea Best regards, --=20 Mete Durlu