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 78D20382F34 for ; Fri, 3 Apr 2026 13:43:03 +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=1775223786; cv=none; b=F6dkcj4dTYlp+B8OmMEKLnTzEdLnQJlKXM3fwSFOdbZ8VWULxZ85MIjyG2Y+suDjZ+oNn9XtjaFiQ3brsrR+Q0+hSTObq4KmK/eV6Pz1YnXXFYaZ/LGL9ClbaMcbEKi0svAbMQptbGjk7PzfNQ+uaBCTYcjs9AWzxpsnoxZgKj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775223786; c=relaxed/simple; bh=rSPqIuqhQ5jockF+2+VSyiGSLw1pwa+EXAmG34lo0XM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Y/5GI5Ct7lrAVG1t4dZjDICLoP+6xBI1n7jeZYKrdFg1e/pb+YEgBeugPzOv+iDky5b3DRjms+Td6HlaHLF/vqVpf9CPoGmy3I9xYbgcn4k776VR8OsdAWRAMuwwYFsS5fCLKxRipcgU7/w4mWyTijIvP2v3wUUB4u8t4wREtBk= 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=C1YuRKOx; 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="C1YuRKOx" 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=RW3fWDhNBOH1PYKlzEuJkVBOtS7qeAfJPCOjjQ97JQA=; b=C1YuRKOxkanvOTE+Hn8cpWQxiK LMAgpumXIkjfAOQn+8/8az/9zWvYyVStjXBePzYv2ikfPBP5Szrz2z/ZH3fZNo6EKwx56jXPsDFKk eDjd1TOXyM20JfMHOdJi8c++flY06abc5DwvOF14R+zWAMW9WZ3HbFymGlaOEfP2FWPEhuVR9JYKZ RJjVAAqP1XxEfiMhFO/Dmeb2ICrAhaFuQQ0iIDLTYcRXRaKsNKdENwmXpisnjIbBXpDsdp+XB5T4M 2MCYNOrIyVwsMVLUu7JFYTdwEUby51bwpBqbSJaVhKyk9AuN5xBLnqqXbnjTs6eBa342mOXQZCkgv PlRbFu6w==; Received: from 77-249-17-252.cable.dynamic.v4.ziggo.nl ([77.249.17.252] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.98.2 #2 (Red Hat Linux)) id 1w8ena-00000004BeZ-1nZp; Fri, 03 Apr 2026 13:42:58 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id A471C3004F8; Fri, 03 Apr 2026 15:42:56 +0200 (CEST) Date: Fri, 3 Apr 2026 15:42:56 +0200 From: Peter Zijlstra To: soolaugust@gmail.com Cc: jstultz@google.com, juri.lelli@redhat.com, mingo@redhat.com, linux-kernel@vger.kernel.org, zhidao su , Andrea Righi Subject: Re: [PATCH] sched/deadline: Fix stale dl_defer_running in update_dl_entity() if-branch Message-ID: <20260403134256.GH3558198@noisy.programming.kicks-ass.net> References: <20260403081215.3942454-1-soolaugust@gmail.com> 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: <20260403081215.3942454-1-soolaugust@gmail.com> On Fri, Apr 03, 2026 at 04:12:15PM +0800, soolaugust@gmail.com wrote: > From: zhidao su > > commit 115135422562 ("sched/deadline: Fix 'stuck' dl_server") added a > dl_defer_running = 0 reset in the if-branch of update_dl_entity() to > handle the case where [4] D->A is followed by [1] A->B (lapsed > deadline). The intent was to ensure the server re-enters the zero-laxity > wait when restarted after the deadline has passed. > > With Proxy Execution (PE), RT tasks proxied through the scheduler appear > to trigger frequent dl_server_start() calls with expired deadlines. When > this happens with dl_defer_running=1 (from a prior starvation episode), > Peter's fix forces the fair_server back through the ~950ms zero-laxity > wait each time. > > In our testing (virtme-ng, 4 CPUs, 4G RAM, ksched_football): > With this fix: ~1s for all players to check in > Without this fix: ~28s for all players to check in > > The issue appears to be that the clearing in update_dl_entity()'s > if-branch is too aggressive for the PE use case. > replenish_dl_new_period() already handles this via its internal guard: > > if (dl_se->dl_defer && !dl_se->dl_defer_running) { > dl_se->dl_throttled = 1; > dl_se->dl_defer_armed = 1; > } > > When dl_defer_running=1 (starvation previously confirmed by the > zero-laxity timer), replenish_dl_new_period() skips arming the > zero-laxity timer, allowing the server to run directly. This seems > correct: once starvation has been confirmed, subsequent start/stop > cycles triggered by PE should not re-introduce the deferral delay. > > Note: this is the same change as the HACK revert in John's PE series > (679ede58445 "HACK: Revert 'sched/deadline: Fix stuck dl_server'"), > but with the rationale documented. > > The state machine comment is updated to reflect the actual behavior of > replenish_dl_new_period() when dl_defer_running=1. > > Signed-off-by: zhidao su > --- > kernel/sched/deadline.c | 12 +++--------- > 1 file changed, 3 insertions(+), 9 deletions(-) > > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > index 01754d699f0..30b03021fce 100644 > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c > @@ -1034,12 +1034,6 @@ static void update_dl_entity(struct sched_dl_entity *dl_se) > return; > } > > - /* > - * When [4] D->A is followed by [1] A->B, dl_defer_running > - * needs to be cleared, otherwise it will fail to properly > - * start the zero-laxity timer. > - */ > - dl_se->dl_defer_running = 0; > replenish_dl_new_period(dl_se, rq); > } else if (dl_server(dl_se) && dl_se->dl_defer) { > /* This cannot be right; it will insta break Andrea's test case again. And I cannot make sense of your explanation; how does PE cause what to happen? You mention PROXY_WAKING, this then means proxy_force_return(). I suspect whatever it is you're seeing will go away once we delete that thing, see this discussion: https://lkml.kernel.org/r/20260402155055.GV3738010@noisy.programming.kicks-ass.net