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 400FC314D1F; Fri, 20 Mar 2026 14:59:25 +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=1774018768; cv=none; b=n57nkXgtBortR22mJKx1raRI7/zkLytP/RoiQgBekXfHvvFyaVs3bM6O6+lmP/3c6pmW4DonoEyyGVirJnxkHKZcRyktgUbAhXIOL7HigR22Gl8iDHAzLgaU1bb+B9PLnt0jve9Tu8XmvuPz4zLAXqbm3YwXYb84iK6miaz3Tjg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774018768; c=relaxed/simple; bh=kEooM/NcXM8O5lPrA3qd/MzNu/WVTqgZJtNW4hSGGGE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=a9lgl6LGAGXOPtnD4BaP+cjvWVddTUVjKZOjMKYySTCijra0NZxyA1c0IS173M4n2EAaZW5lKgkiH9CykHKMWrPnzBnFwEV2t09GLyrEjHVe7yJUo406xpBlIxC4Irg6qxjUM4O4/3w2Y7btYhuojZgsnjxw21p2cI9DhByXFto= 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=tFsopE9L; 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="tFsopE9L" 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 62K4Ce9I802517; Fri, 20 Mar 2026 14:59:17 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=VF2Dxv GBrNWyiHNHIycmPlY8In/Q19p7nVqNsRpbNI4=; b=tFsopE9L0801d5GDu4dUBr jtsy5csHcZPwANRyTyQK2udjywHvAHotQBzFOj9QzAA64h56Bz0PusYMC1b0tQwf 9eCtIka/mJKlJWTiWrpLjEMqV/YIX9RoBgscc+gmkrVZ4D6uqCaldzWN8k42TKlF /SoNpd4qzBeuP1ayQMxfHBJnuB/lO9BwwvKUannQc/yh+N8a1avjEiBOc0agY0NC mZVWR9iLDdwpbR6MKlaF7UCNrMXy+RjcXAsu7YNEfisXFCh0euhIgwxTxrw/VWd7 anTm/cCu9xjVxEuLwTItYZsDqpu8NBVDz6PrJFa2hk6ndE7TbQc6xvSkLAIqCRsg == 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 4cvybsm42p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Mar 2026 14:59:16 +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 62KBo88B013997; Fri, 20 Mar 2026 14:59:15 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 4cwjcyfnwb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Mar 2026 14:59:15 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 62KExD5O29295100 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Mar 2026 14:59:13 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8145320043; Fri, 20 Mar 2026 14:59:13 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 40AAA20040; Fri, 20 Mar 2026 14:59:12 +0000 (GMT) Received: from [9.39.23.72] (unknown [9.39.23.72]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 20 Mar 2026 14:59:12 +0000 (GMT) Message-ID: <2fcb640d-a7b7-43dd-b057-50d90d4ca0db@linux.ibm.com> Date: Fri, 20 Mar 2026 20:29:11 +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: [tip: sched/hrtick] sched/eevdf: Fix HRTICK duration To: Thomas Gleixner , "Peter Zijlstra (Intel)" Cc: linux-kernel@vger.kernel.org, Juri Lelli , x86@kernel.org, linux-tip-commits@vger.kernel.org References: <20260224163428.798198874@kernel.org> <177229302335.1647592.2614799712513216333.tip-bot2@tip-bot2> From: Shrikanth Hegde Content-Language: en-US In-Reply-To: <177229302335.1647592.2614799712513216333.tip-bot2@tip-bot2> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Authority-Analysis: v=2.4 cv=MMttWcZl c=1 sm=1 tr=0 ts=69bd60c4 cx=c_pps a=5BHTudwdYE3Te8bg5FgnPg==:117 a=5BHTudwdYE3Te8bg5FgnPg==:17 a=IkcTkHD0fZMA:10 a=Yq5XynenixoA:10 a=VkNPw1HP01LnGYTKEx00:22 a=RnoormkPH1_aCDwRdu11:22 a=uAbxVGIbfxUO_5tXvNgY:22 a=VwQbUJbxAAAA:8 a=bC-a23v3AAAA:8 a=JfrnYn6hAAAA:8 a=20KFwNOVAAAA:8 a=-SzkY62Alx65AlYTObkA:9 a=QEXdDO2ut3YA:10 a=FO4_E8m0qiDe52t0p3_H:22 a=1CNFftbPRP8L7MoqJWF3:22 X-Proofpoint-ORIG-GUID: Xe4VdyETwTfTfGMHR1qgAYuYj3nQnR72 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzIwMDExNyBTYWx0ZWRfXzdfdhjStLfw4 X2xJ4DVtUrJ/FpsocmFskLpPRq/PgQN2osIDzYA2QDGx7DbqGThqsBIcVIykXZ/KTpVzsWsjaE0 0wQHHqCJtOQ/XH6SKQ7uMJbHxLhpnzlIIMdejpq2G1vp7X8XYFwKX22B2eRq9zTpRadGnO5hDiN 9+ckPBJHritX87cTYyqo9ljxSCyOM3ZgSkX2eZM8btRtwn/L6ZC7fYlFQl6/tlegD1wdsBxnB4d Z/EtuR+qY4l1NNSu7YWIFsXCbYDTBzY1JYUsK8J++CGI7bx1rbqnCfsHHqPeHbbOKKZlVapocZI ZzjLlfAt2f+iuN+alQiDTg9Meoeuux7FknrnMlxkR3VgjWU+MbxphEayyLEyojFzVG2vdWADxSQ AWT0MlKZCHUDPIIfrj6zK0wdi1iV6AOpoSRB9Y7ATnNNuL6+7xiDgPsagqlZsLcmsO8fz/Xnp2/ 6JwCMMdcAnROUhzMC+A== X-Proofpoint-GUID: Xe4VdyETwTfTfGMHR1qgAYuYj3nQnR72 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-20_02,2026-03-19_05,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 malwarescore=0 spamscore=0 priorityscore=1501 impostorscore=0 adultscore=0 phishscore=0 clxscore=1011 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2603050001 definitions=main-2603200117 Sorry for very very late reply. I was trying to go through this. On 2/28/26 9:07 PM, tip-bot2 for Peter Zijlstra wrote: > The following commit has been merged into the sched/hrtick branch of tip: > > Commit-ID: 558c18d3fbb6c5b9c0b42629d7fe34476363ac00 > Gitweb: https://git.kernel.org/tip/558c18d3fbb6c5b9c0b42629d7fe34476363ac00 > Author: Peter Zijlstra > AuthorDate: Tue, 24 Feb 2026 17:35:17 +01:00 > Committer: Peter Zijlstra > CommitterDate: Fri, 27 Feb 2026 16:40:03 +01:00 > > sched/eevdf: Fix HRTICK duration > > The nominal duration for an EEVDF task to run is until its deadline. At > which point the deadline is moved ahead and a new task selection is done. > > Try and predict the time 'lost' to higher scheduling classes. Since this is > an estimate, the timer can be both early or late. In case it is early > task_tick_fair() will take the !need_resched() path and restarts the timer. > > Signed-off-by: Peter Zijlstra (Intel) > Signed-off-by: Thomas Gleixner > Signed-off-by: Peter Zijlstra (Intel) > Reviewed-by: Juri Lelli > Link: https://patch.msgid.link/20260224163428.798198874@kernel.org > --- > kernel/sched/fair.c | 41 +++++++++++++++++++++++++++-------------- > 1 file changed, 27 insertions(+), 14 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index eea99ec..247fecd 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -6735,21 +6735,37 @@ static inline void sched_fair_update_stop_tick(struct rq *rq, struct task_struct > static void hrtick_start_fair(struct rq *rq, struct task_struct *p) > { > struct sched_entity *se = &p->se; > + unsigned long scale = 1024; > + unsigned long util = 0; > + u64 vdelta; > + u64 delta; > > WARN_ON_ONCE(task_rq(p) != rq); > > - if (rq->cfs.h_nr_queued > 1) { > - u64 ran = se->sum_exec_runtime - se->prev_sum_exec_runtime; > - u64 slice = se->slice; > - s64 delta = slice - ran; > + if (rq->cfs.h_nr_queued <= 1) > + return; > > - if (delta < 0) { > - if (task_current_donor(rq, p)) > - resched_curr(rq); > - return; > - } > - hrtick_start(rq, delta); > + /* > + * Compute time until virtual deadline > + */ > + vdelta = se->deadline - se->vruntime; > + if ((s64)vdelta < 0) { > + if (task_current_donor(rq, p)) > + resched_curr(rq); > + return; > } > + delta = (se->load.weight * vdelta) / NICE_0_LOAD; > + > + /* > + * Correct for instantaneous load of other classes. > + */ > + util += cpu_util_irq(rq); > + if (util && util < 1024) { > + scale *= 1024; > + scale /= (1024 - util); > + } Comments/Changelog says other classes. Then why not consider cpu_util_dl, cpu_util_rq too? Is there a reason why these are not taken into calculations? > + > + hrtick_start(rq, (scale * delta) / 1024); > } > > /* > @@ -13365,11 +13381,8 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued) > entity_tick(cfs_rq, se, queued); > } > > - if (queued) { > - if (!need_resched()) > - hrtick_start_fair(rq, curr); > + if (queued) > return; > - } > > if (static_branch_unlikely(&sched_numa_balancing)) > task_tick_numa(rq, curr);