From mboxrd@z Thu Jan 1 00:00:00 1970 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 58B6B1D7E5C for ; Sun, 9 Aug 2026 10:03:27 +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=1786269808; cv=none; b=gO7UzsiqkZU/waaVBqmbiBt4c7nmwkcgdEtcKvPuroSr0szeuoHX71UdG+5ONUJfE8GSD3DL2/IKZRLZBYikuyWzIbhgmIf+1Fmu3uY8a+SGLLKekROlEkK3UaYfMuLUDYbEbKP52Y0l9motxSH86TbBYssvBpH+Huh73kN2I4o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786269808; c=relaxed/simple; bh=WUQNlyWJemECXbkNnuGGHqfOxbzkn7YtHiPCA3SAH+U=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jsI5wuni7Hm1y092wZeTXkurmMr6ABYD+8m+sLIqd/kyxFHBEJ7ARWIbqY75ZToup2mUkdBtlljgABQp/wQCiHnFVaqfwYUjknwCc/APWT5jREVZkXed0Ge80xLHn2leYF6tV57+o939gNwZNz9sxy9kVxv1lFCJvkg8qn4DjE8= 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=sIF1BrUb; 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="sIF1BrUb" Received: from pps.filterd (m0360083.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 67991QBG2525970; Sun, 9 Aug 2026 10:02:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=HHS5Xk I9tjsbkKtJ3kVZ9wqEDmRRnzFF00ol4S0wOcY=; b=sIF1BrUbe3JDaIZ6xN7/Y6 z4lnpUuzlKTvX74/4jmjldd/NJaABlk8nY50cVGIfdVjbIdzrZxmGEU/aTkk5ouF r5Ja5XObt6iRCckzELlWrj+TMmzeYnGxpLal3myrI8FcGb0X0ZyTIVbEFLKAgvl/ +Ag8TB/uu2RrrjirvdsEzFuQdYSiJrIw23KGgWvCb+ae6fzET/UJinxdPtnjwxMF RamdGjaymS+QsGl57m+2xGHohn0ZSLvvRQB35cZtxCxObV9CKiNV5SJwH9BhvlKh GDsg3QLo4ahr14Tuac/+I0mvMJnHVk6uR+zzeGG0IiQ0XFwBEJaspTFcjB2Qmr2w == Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4fwvq93v8x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 09 Aug 2026 10:02:56 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.18.1.7/8.18.1.7) with ESMTP id 6799uhkt020254; Sun, 9 Aug 2026 10:02:55 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4fxfsjh0wa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 09 Aug 2026 10:02:55 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 679A2qrs33685890 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 9 Aug 2026 10:02:53 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E1C502004E; Sun, 9 Aug 2026 10:02:52 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2589220043; Sun, 9 Aug 2026 10:02:52 +0000 (GMT) Received: from [9.111.6.179] (unknown [9.111.6.179]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Sun, 9 Aug 2026 10:02:52 +0000 (GMT) Message-ID: <986cef14-f6fd-48b3-843c-d2098527150f@linux.ibm.com> Date: Sun, 9 Aug 2026 12:02:51 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] sched/fair: Make is_core_idle() check all cpus in a core To: Zhan Xusheng Cc: Zhan Xusheng , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Valentin Schneider , K Prateek Nayak , Zhan Xusheng , Ilya Leoshkevich , linux-kernel@vger.kernel.org References: <20260806-fix_is_core_idle-v1-1-605119e55b25@linux.ibm.com> <20260807034211.1148245-1-zhanxusheng@xiaomi.com> Content-Language: en-US From: Mete Durlu In-Reply-To: <20260807034211.1148245-1-zhanxusheng@xiaomi.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Reinject: loops=2 maxloops=12 X-Proofpoint-GUID: FMi7XtCnq5slgvcT_zcnVWL9PyS5uGrq X-Authority-Analysis: v=2.4 cv=PbDPQChd c=1 sm=1 tr=0 ts=6a785050 cx=c_pps a=GFwsV6G8L6GxiO2Y/PsHdQ==:117 a=GFwsV6G8L6GxiO2Y/PsHdQ==:17 a=IkcTkHD0fZMA:10 a=Sv0fKeRqtYgA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=iQ6ETzBq9ecOQQE5vZCe:22 a=tgv5XJSNWND_sRfM-JsA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwODA5MDA4OCBTYWx0ZWRfX+2sZeCvhU3Jo AzSofNkdgdzttTqG+z+Z63N01gjSXLR0B7N7B1Drv5gAjSmOYLMjTqKQKGf1qORfP0p6jiibiHn 7CTvU5LvVSXYG85qWa4gy1BWRFmeSRlfOdAbnK20z8VnstO4RhIeMJ+eyYBnWtpuu5q43F21Wo+ y8u8XtM/U5lhySXi2fAMc8cM5g/yXxlzcJerGNrOfpo0srEY7awNNUosFJoUa9olD9/vmy7VOOr Ili+oYSBImLk7Lv0Nd2/fFZp5/1I3iFSwWo+MAfGIhBN5DYDkgpyxIM+U9qcH5LmRfV4fADDFcH iU1TXcu/d+r4WsLhj9hxJLsQ7gz+Il+5FPDPiqp1SICXiZt5S9cTIVZcPGUAMfYe2kT3SxJjXpg p+tfomAILdAdyckbQem3BrMC+ZZB1cvPwqsMQaEO5XA1CcRqD1ssKg2UrjfmXBqyPkeOjyHVpJZ RXbW1cAYIB+DUxbQOyA== X-Proofpoint-ORIG-GUID: Jq8JwPm-B39I3-MmRfH7LJXvJoxzxQet X-Proofpoint-Spam-Info: AW1haW4tMjYwODA5MDA4OCBTYWx0ZWRfX2HMBBGQBts3+ iLleXWF7HHx8YQDf933CSa/k4bW8BBsf3xWxjY9JkZE/2Sk5BhGWjW7PEWLXlxY01NW7iZxESSr 0PDL8Qf/h1yimD/1J586Vh/tFB7gLlw= 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-09_03,2026-08-07_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 impostorscore=0 malwarescore=0 adultscore=0 clxscore=1011 priorityscore=1501 suspectscore=0 phishscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2608090088 Hi, > The skip is what lets a caller ask this from a CPU that is about to become > idle, where idle_cpu() cannot be true yet. > > sched_balance_newidle() calls > > sched_balance_rq(this_cpu, this_rq, sd, CPU_NEWLY_IDLE, ...) > > so env->dst_cpu is this_cpu, and we are inside __schedule() with rq->curr > still the outgoing task. idle_rq() wants rq->curr == rq->idle, so > idle_cpu(this_cpu) is false. __CPU_NOT_IDLE is 0, so the env->idle test in > update_sg_lb_stats() does not filter CPU_NEWLY_IDLE out either. For every > newidle balance the patch therefore gives: > > env->dst_core_idle false, so the misfit gate in > update_sd_pick_busiest() stops pulling > sched_use_asym_prio() false, so asym packing no longer applies > > s390 cannot show that: SD_ASYM_PACKING is set only by powerpc and x86 ITMT, > SD_ASYM_CPUCAPACITY only by arm64 big.LITTLE and x86 hybrid. Thank you for the detailed explanation. I totally overlooked the CPU_NEWLY_IDLE case. > The other callers -- numa_idle_core(), select_idle_capacity(), > asym_fits_cpu(), should_we_balance() -- all establish idle_cpu(cpu) first, > so there this only adds a redundant idle_cpu() per candidate, two of them > on the wakeup path. I thought idle_cpu() is a cheap call to make and an extra one wouldn't make a difference. > Since the complaint is really the name, would renaming it do the job > without touching behaviour? asym_fits_cpu() already words it as "the core > has no busy siblings", and sched_use_asym_prio()'s kernel-doc treats @cpu's > idleness as the caller's precondition. Right, a rename sounds like a better option to me now. I'll send a new version. > dst_core_idle may well want whole-core semantics as its comment says, but > that reads like a separate patch with numbers from an asymmetric-capacity > machine. I suppose after the rename, the code block would represent what is being done more clearly and cause more people to raise their eyebrows. Maybe then we get some measurements :) Thanks!