From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=158.69.130.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796309992; b=OPNHzSxut6e2JE/rKq92Y3mNT6k04gfnxvxp2dUV56UAorg1U3Sss8OJwS0B2dBQTzqJ jHyjWLHqV6F4HM2eEX31nyxRN0rz2jGHIQSn0b3YMw9Wvx77Sp9WWZkopDVbMvVW+LgbX dxNJHzaafkRjmnk/uylBaD+HhnhifvWaybFK53UG0kJv+O2IjItsNCDpcG8QHiNHc4QK3 uXAeq0OX/eH+2HKRpiGOhgdohouSY6dfr+9ytqkTV7AIVBuD2ub/II70mPLVqz5hvw+QA CnNoM+A01UavLwCUC5Bqe5q/xLcEQUtVgwhD+zHRN2eJkERFOcPwyAPSE4N6/rXmevg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796309992; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=rku50ivPCm7j1+hqO/p6rrOAHVpBTrokfHycmW5lYcA=; b=CF2yOSfJ5j3IZnlheSaCd78+abASTU8eruv92Bunx7iBdOq4PrI7D1k+tkxUpbQPpbjY Kk4ODdqMJmmRN3J/jHHetpZHWLRaxS4Hf0lMRkypUwv4PW6gFOQSdtesYxifuXWB/Eqs5 p6/OLLnskQj+4mpY8/LTk6ratAxr4QzJKIvjRoRwA5EJiea5N1DNq8+6iHqFPC5EGvmQf xAdyTZhicLICv+vQvjS+t+XS2wk/mJCuOD4nM1NrZWE+VF73PSec00GEfteS8xOGjW+3p wnQ964TxrBdRr8cFRc3Ouurl9WemHu7UZOuVygZDnkeNutPw1WARIW9U8HZ64yudi/A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=gyzi3n4A; arc=none smtp.remote-ip=158.69.130.18 Received: from smtpout.efficios.com (smtpout.efficios.com [158.69.130.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BA96606CFA1; Thu, 3 Dec 2026 14:59:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7BA96606CFA1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=gyzi3n4A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1796309991; bh=rku50ivPCm7j1+hqO/p6rrOAHVpBTrokfHycmW5lYcA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gyzi3n4A3rwkhI0GmLTWZzlkINk2sabgXEsqWDcnGmI91HlsAWydWLBkWI/kGrGzv 5xyisgCUsx9Sjh17iBCUZEHlIvIBMS7nmqVzr5t8bSbbBaiC0YbWPrCfMofTuZYcFu EdMhIh3mVtRPOTy89WrUEWIXYP/qtBzHqm9MXK+L5lhw0/3Beh2rcApN/Hn/UDk+dS tUzPKR65hMHM7u0NMarAMWW+eXc8uusMDTvVtLiXiNaY5U/4r/WbPoiy7WgxGoXjMs T7XhZmTSG6NOhP5+KwdU27YVvaCqU71ouYJSmqTQgF2wvqW/nwIxf3dA6jMpri0xq7 GO2ZaXvrK9u9Q== Received: from thinkos.internal.efficios.com (unknown [IPv6:2605:8d80:7180:6739:ac39:5d4:4093:61c6]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4jgHpt177tzZWv; Thu, 03 Dec 2026 09:59:50 -0500 (EST) From: Mathieu Desnoyers To: juri.lelli@redhat.com, peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org Cc: Mathieu Desnoyers , tglx@kernel.org, anna-maria@linutronix.de, frederic@kernel.org, will@kernel.org, boqun@kernel.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com, kprateek.nayak@amd.com, luca.abeni@santannapisa.it, tommaso.cucinotta@gmail.com, mathieu.poirier@linaro.org, longman@redhat.com, ridong.chen@linux.dev, tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, shuah@kernel.org, bigeasy@linutronix.de, clrkwllms@kernel.org, parri.andrea@gmail.com, m.szyprowski@samsung.com, kayracizmeci@gmail.com, weihengqiuu@gmail.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-rt-devel@lists.linux.dev, oleg@redhat.com, brauner@kernel.org, stable@vger.kernel.org Subject: [PATCH v14 28/39] sched/deadline: Cancel the replenishment timer with the parameters Date: Thu, 3 Dec 2026 09:58:42 -0500 Message-ID: X-Mailer: git-send-email 2.47.3 In-Reply-To: References: X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit A task that leaves SCHED_DEADLINE has its parameters cleared at its 0-lag time. Its replenishment timer can still be armed then. If the task comes back and throttles before that timer fires, start_dl_timer() does not restart it, since it is queued. The replenishment would then come at the period of the reservation the task left. Too early, it would give the task runtime it has not earned. Too late, it would delay the task by up to a period. Commit a649f237db18 ("sched,dl: Fix sched class hopping CBS hole") armed the replenishment timer when a task leaves the class. The timer then reset the task if it was still out. Commit 209a0cbda7a0 ("sched/deadline: Improve the tracking of active utilization") moved that reset to the inactive timer, at the 0-lag time. Nothing cancels the replenishment timer there. The timer of a throttled task fires at its next period, which can come after the 0-lag time. A task that yielded is throttled with runtime left. Its 0-lag time comes before its deadline. On v7.4-rc2, a constrained-deadline task that overran by little also reaches its 0-lag time before the end of its period. "sched/deadline: Count the 0-lag time from the next period", earlier in this series, puts that 0-lag time after the next period. Fix this by cancelling the timer where the parameters are cleared. This includes task_non_contending(). switched_from_dl() calls it to release the bandwidth of a task that leaves asleep past its 0-lag time. A constrained task that overran as it blocked has the timer armed there too. The Sashiko AI review of this series found this. It has no reproducer. Fixes: 209a0cbda7a0 ("sched/deadline: Improve the tracking of active utilization") Signed-off-by: Mathieu Desnoyers Reviewed-by: Juri Lelli Cc: stable@vger.kernel.org --- kernel/sched/deadline.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index 081c5812a063..82066b2402a9 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -781,6 +781,7 @@ static void task_non_contending(struct sched_dl_entity *dl_se, bool dl_task) if (dl_task && READ_ONCE(p->__state) == TASK_DEAD) sub_rq_bw(dl_se, &rq->dl); dl_task_release_bw(p); + cancel_replenish_timer(dl_se); dl_release_params(dl_se); } } @@ -2630,6 +2631,7 @@ static enum hrtimer_restart inactive_task_timer(struct hrtimer *timer) } dl_task_release_bw(p); + cancel_replenish_timer(dl_se); dl_release_params(dl_se); goto unlock; -- 2.47.3