From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 8634634C826 for ; Tue, 7 Apr 2026 15:00:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.92.199 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775574037; cv=none; b=E3xGurRkFjlxhNOHt3eiaHHi2Pyp1acFAENeOUsB3uNTK+EeCm+crvrs/6rblWojzzSR4P9+5Rmo+f3DbDW9mhPMSL4GiVLxNqpn3UhW5uCOp4O1ffvFlalrd/PHe2hqkmFny+EiPmJbvCyZr3kGe/uJ4jbdhOjj5pQAVcAVcdk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775574037; c=relaxed/simple; bh=YyAmRKBNc9NTWT94AZHkFprd0Hx0ogSCVlYbAR08o1Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z01JXd40W3dNlJvz9Yd00aBh4vRONmugNrXRC/a38XYBCJ8+Ptoai8poxaoDp99r8vG8gxTsh3cMMq226AxqUwYwRr35tg0oNPnHtBSYXXktWi5XOeIf2dG6SF25wGML2f48paZWrAt6LQhgLEl7rxuzPzkKDqCGt/3BjJL8VJE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=N6BM1XHc; arc=none smtp.client-ip=90.155.92.199 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="N6BM1XHc" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=OcIOVGa0bqgRSXotKV+SiboVVeci/fE6mt6lR+JvrBE=; b=N6BM1XHc+A7J5a74CROZwNw/Tc V9nVXNVrX9XtfK6HaNV75k1xn0hderFXgZxgkhNtadM0pTKO4OixSorQ+dZ5RSauu99LakbLOLPJ8 i2Ox16TUAjpT5JFaDoOqpN8pW47tgTY2Gqz9vJIlfde6lApnsS4BpSMJikenh6SQOIXN3XMTCESEi vl3H/bzhZZWJxMabZ833NOFY92xmAe1J9vXQr1/ajlMDGFAr7flJRF9TFvH+oUfXJnsyT2fxtRe7E dNSZDs2bK8af/nLX7YWM/QohlSaQzmx2ixIvfMJRCmOph8AzhjRT2SA1gNeqhmAIyQ3EfSQ29isrI r++O6/aA==; Received: from 2001-1c00-8d85-4b00-266e-96ff-fe07-7dcc.cable.dynamic.v6.ziggo.nl ([2001:1c00:8d85:4b00:266e:96ff:fe07:7dcc] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1wA7um-00000008Xe1-20MF; Tue, 07 Apr 2026 15:00:28 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 1FE79301C52; Tue, 07 Apr 2026 17:00:27 +0200 (CEST) Date: Tue, 7 Apr 2026 17:00:27 +0200 From: Peter Zijlstra To: Juri Lelli Cc: John Stultz , soolaugust@gmail.com, mingo@redhat.com, linux-kernel@vger.kernel.org, zhidao su , Andrea Righi , luca.abeni@santannapisa.it Subject: Re: [PATCH] sched/deadline: Fix stale dl_defer_running in update_dl_entity() if-branch Message-ID: <20260407150027.GI3738010@noisy.programming.kicks-ass.net> References: <20260403081215.3942454-1-soolaugust@gmail.com> <20260403134256.GH3558198@noisy.programming.kicks-ass.net> <20260403224610.GJ2872@noisy.programming.kicks-ass.net> <20260404102244.GB22575@noisy.programming.kicks-ass.net> 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=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Apr 07, 2026 at 02:22:58PM +0200, Juri Lelli wrote: > > Random brain wave... > > > > Since the dl_server is LLF (deferred), it will pretty much always trip > > the dl_entity_overflow() when interrupted, right? Does it make sense to > > use the revised wake-up rule for it, when appropriate? > > > > --- > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > > index d08b00429323..674de6a48551 100644 > > --- a/kernel/sched/deadline.c > > +++ b/kernel/sched/deadline.c > > @@ -1027,7 +1027,7 @@ static void update_dl_entity(struct sched_dl_entity *dl_se) > > if (dl_time_before(dl_se->deadline, rq_clock(rq)) || > > dl_entity_overflow(dl_se, rq_clock(rq))) { > > > > - if (unlikely(!dl_is_implicit(dl_se) && > > + if (unlikely((!dl_is_implicit(dl_se) || dl_se->dl_defer) && > > !dl_time_before(dl_se->deadline, rq_clock(rq)) && > > !is_dl_boosted(dl_se))) { > > update_dl_revised_wakeup(dl_se, rq); > > > > So to keep boosting, by reducing runtime appropriately, until the end of > the current dl-server period. Makes sense to me. OK, like so then. --- Subject: sched/deadline: Use revised wakeup rule for dl_server From: Peter Zijlstra Date: Sat, 4 Apr 2026 12:22:44 +0200 John noted that commit 115135422562 ("sched/deadline: Fix 'stuck' dl_server") unfixed the issue from commit a3a70caf7906 ("sched/deadline: Fix dl_server behaviour"). The issue in commit 115135422562 was for wakeups of the server after the deadline; in which case you *have* to start a new period. The case for a3a70caf7906 is wakeups before the deadline. Now, because the server is effectively running a least-laxity policy, it means that any wakeup during the runnable phase means dl_entity_overflow() will be true. This means we need to adjust the runtime to allow it to still run until the existing deadline expires. Use the revised wakeup rule for dl_defer entities. Fixes: 115135422562 ("sched/deadline: Fix 'stuck' dl_server") Reported-by: John Stultz Signed-off-by: Peter Zijlstra (Intel) Acked-by: Juri Lelli Tested-by: John Stultz Link: https://patch.msgid.link/20260404102244.GB22575@noisy.programming.kicks-ass.net --- kernel/sched/deadline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -1027,7 +1027,7 @@ static void update_dl_entity(struct sche if (dl_time_before(dl_se->deadline, rq_clock(rq)) || dl_entity_overflow(dl_se, rq_clock(rq))) { - if (unlikely(!dl_is_implicit(dl_se) && + if (unlikely((!dl_is_implicit(dl_se) || dl_se->dl_defer) && !dl_time_before(dl_se->deadline, rq_clock(rq)) && !is_dl_boosted(dl_se))) { update_dl_revised_wakeup(dl_se, rq);