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 00D003B8D62 for ; Sun, 7 Dec 2025 13:24:04 +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=1765113846; cv=none; b=HC4HpJs00kZ/badsAaDJTb1uPsqMnzBWgtXSpi2KhZCkMxMfiJm+m+1PXR+Dlqb9DmtKDsFMwa6Q7IvILG/J9236PcwxPrlf4Cyypy8W79JHqNaeCNl48s9BjvEDIw1pObYbcbcwlkca6RV9HQXLqn1WWwkABvNofwjLcV3WW4g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765113846; c=relaxed/simple; bh=f6/Q/kcqx0k7ios+l6a9wSuuZuqL0YwsU10pZA44TF8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=akMib87ez5ktUoKwprQy+RCz3d0Gzk82Oqn/5zzCAbRMGfXENMHf7hVhwi7sMHtDJr3zio0eJ09WWuRAatUnOnIehvXoW4g57RgRwrSUcFZvJMpeCatCNSHSg/fClItx0B8Pu7jQbx03BpHpWi97Y+cJdACsqSiDYRtIiBo7C/E= 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=IpHqudHl; 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="IpHqudHl" Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 5B7Ce9r2017598; Sun, 7 Dec 2025 13:23:47 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=rE+kNd Er5ppbGEiB+VO1vrV4KbeTbajqMPlWdBXhMBc=; b=IpHqudHlwG22h+E7ncOvUB yHXzjUiPSysxPeudXH2v0XTxxMDHiYfHwfPrTMedmLJaKPMLP3G3DHKZWHJWKfzy sdpT1UXeAW2DS/9Ue/VuaDCMTcbiSHfc5yr+d22i5xU5mNI5S3fGdWFc5bAVTcH5 BM9MSY2oAmuAQBsRdqomOBBmnKg2UbW8LiQHAAaOjHxU/NR/QtypoLTRxEzUhYKK kZgEqoKd7CS781TK5sq8hzfNUbxBpgmZtvJpSrEaIPfyoTkUfGwvY3kmywx8CGbX Ur4ksYEqxoiV8o1tPfWTzgcfnlp1PZlVlhsAmvHqrKfJf7mZUl2VuTGPR6t2XuIw == Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4avc7bm3m0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 07 Dec 2025 13:23:46 +0000 (GMT) Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.18.1.12/8.18.0.8) with ESMTP id 5B7DNkcO025874; Sun, 7 Dec 2025 13:23:46 GMT Received: from ppma13.dal12v.mail.ibm.com (dd.9e.1632.ip4.static.sl-reverse.com [50.22.158.221]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4avc7bm3kw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 07 Dec 2025 13:23:46 +0000 (GMT) Received: from pps.filterd (ppma13.dal12v.mail.ibm.com [127.0.0.1]) by ppma13.dal12v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 5B79EWbA002034; Sun, 7 Dec 2025 13:23:45 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma13.dal12v.mail.ibm.com (PPS) with ESMTPS id 4aw11j1eg7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 07 Dec 2025 13:23:45 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 5B7DNhga22151744 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 7 Dec 2025 13:23:43 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5000F20043; Sun, 7 Dec 2025 13:23:43 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E676820040; Sun, 7 Dec 2025 13:23:39 +0000 (GMT) Received: from [9.39.31.222] (unknown [9.39.31.222]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Sun, 7 Dec 2025 13:23:39 +0000 (GMT) Message-ID: <07c8435d-c396-4b53-bee5-765469fa8762@linux.ibm.com> Date: Sun, 7 Dec 2025 18:53:38 +0530 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 3/6 v8] sched/fair: Prepare select_task_rq_fair() to be called for new cases To: Vincent Guittot Cc: qyousef@layalina.io, hongyan.xia2@arm.com, christian.loehle@arm.com, luis.machado@arm.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, linux-kernel@vger.kernel.org, pierre.gondois@arm.com, kprateek.nayak@amd.com References: <20251202181242.1536213-1-vincent.guittot@linaro.org> <20251202181242.1536213-4-vincent.guittot@linaro.org> From: Shrikanth Hegde Content-Language: en-US In-Reply-To: <20251202181242.1536213-4-vincent.guittot@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 9W-fp8cNzz0pI2EWDEuYbj8klk8Uj76W X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMjA2MDAyMCBTYWx0ZWRfXyOErYBQvkDcB TUiv6KeimUJHi1Q1TYR7b4Ir6brFlmB88+3E20hVPsVWJGa1fC+Oqqnuwvxsp/Jhopf2T8E0Mi0 TMDjHddkjRvoHAg3hu0BvzKI1x/V57soX10/R+Cjl11KQz/JpxpsQM2ojjsEQ26XH+314IAKn5a yjXXxl9lLDhHzab1G009R3p3gU/fudm6k0RsgT9HZMxNYw8HEdGg/l4nXLDSZ8wv6xTlr6iJNpu QyB0HKj2lP++WK2+D+S2PYEJXUy29uxFmBoJ2jU4xnlRibemjT9rApZXH7QbsepG4Fw1dN7tXJJ eve6WRki1Zmm0fRzLpOTPNBJIkAy6LnjZ01G70LNWWmK62gWN8SSGTQHm4EEL23VM9LVvzmrqcQ 6KKuCg4qtTd7j75sTiO3xh7Vqk1MTw== X-Proofpoint-GUID: 1AxJdEvMey5Ku_-zgNPpf5ycP0Po7W21 X-Authority-Analysis: v=2.4 cv=FpwIPmrq c=1 sm=1 tr=0 ts=69357fe2 cx=c_pps a=AfN7/Ok6k8XGzOShvHwTGQ==:117 a=AfN7/Ok6k8XGzOShvHwTGQ==:17 a=IkcTkHD0fZMA:10 a=wP3pNCr1ah4A:10 a=VkNPw1HP01LnGYTKEx00:22 a=KKAkSRfTAAAA:8 a=ujLMawT_f2o4EpPwgKUA:9 a=QEXdDO2ut3YA:10 a=cvBusfyB2V15izCimMoJ:22 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-12-06_02,2025-12-04_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 bulkscore=0 spamscore=0 lowpriorityscore=0 suspectscore=0 malwarescore=0 phishscore=0 clxscore=1015 adultscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510240000 definitions=main-2512060020 On 12/2/25 11:42 PM, Vincent Guittot wrote: > Update select_task_rq_fair() to be called out of the 3 current cases which > are : > - wake up > - exec > - fork > > We wants to select a rq in some new cases like pushing a runnable task on a > better CPU than the local one. In such case, it's not a wakeup , nor an > exec nor a fork. We make sure to not distrub these cases but still nit: s/distrub/disturb > go through EAS and fast-path. > > Signed-off-by: Vincent Guittot > --- > kernel/sched/fair.c | 22 ++++++++++++++-------- > 1 file changed, 14 insertions(+), 8 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index f430ec890b72..80c4131fb35b 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -8518,6 +8518,7 @@ static int > select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags) > { > int sync = (wake_flags & WF_SYNC) && !(current->flags & PF_EXITING); > + int want_sibling = !(wake_flags & (WF_EXEC | WF_FORK)); > struct sched_domain *tmp, *sd = NULL; > int cpu = smp_processor_id(); > int new_cpu = prev_cpu; > @@ -8535,16 +8536,21 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags) > if ((wake_flags & WF_CURRENT_CPU) && > cpumask_test_cpu(cpu, p->cpus_ptr)) > return cpu; > + } > > - if (!is_rd_overutilized(this_rq()->rd)) { > - new_cpu = find_energy_efficient_cpu(p, prev_cpu); > - if (new_cpu >= 0) > - return new_cpu; > - new_cpu = prev_cpu; > - } > + /* > + * We don't want EAS to be called for exec or fork but it should be > + * called for any other case such as wake up or push callback. > + */ > + if (!is_rd_overutilized(this_rq()->rd) && want_sibling) { > + new_cpu = find_energy_efficient_cpu(p, prev_cpu); > + if (new_cpu >= 0) > + return new_cpu; > + new_cpu = prev_cpu; > + } > > + if (wake_flags & WF_TTWU) > want_affine = !wake_wide(p) && cpumask_test_cpu(cpu, p->cpus_ptr); > - } > > rcu_read_lock(); > for_each_domain(cpu, tmp) { > @@ -8575,7 +8581,7 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int wake_flags) > if (unlikely(sd)) { > /* Slow path */ > new_cpu = sched_balance_find_dst_cpu(sd, p, cpu, prev_cpu, sd_flag); > - } else if (wake_flags & WF_TTWU) { /* XXX always ? */ > + } else if (want_sibling) { It is going to find a idle core withing LLC first. then idle sibling. right? So may need a better name than want_sibling. > /* Fast path */ > new_cpu = select_idle_sibling(p, prev_cpu, new_cpu); > }