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=1794015906; b=iW5TPgohw8iNNa/KrT+K0h77JC8VUBEQb0lYfyAoxM3u3a9eTGPKUr/EVoFR1Nf4WS8L wcQAToyAY4GhYcVZKgW9QXUP2pQ2A0RvtnAZdYeFPLpzjtN1wJwnIElEjqenZAjPZRVVz kag4K+luM9nvjDI4S0kVPiKec50N+rU08Zh0Eys4uVa1R/ylfjKLlMyaMAcWGcNP7OldV EJjt8f5q+lOnzPlqJ2SnBCfi9qo96WazNYqsEH+Gqlfvf9/GgH2abEFpJ7REyZDamt5fL RJcqKmfJDEH+d8SxMkWHoBJdkzVubaIR1NXoqgYdd+XJVYa53bZaJe+BVtOcSoRjOlA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794015906; 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=dZbFr4HtjBuZjWke0zFqxqxv4leAjWoAN7JaAi457w0=; b=Wg4lsrrlOaGzvIR6qV3bZwU/lMYDwmTGswSSpCA/jfBBZzPoXOh1GHZZ+LEBNUP4eYDA GskfUWTbWwTYHMGAieLimXoAIQUfVm6EYte+DicnaAixdHU6in9zu5sk7YfYKeOT5mx4P 5f38kpr24cD3P7pTX/TuHsNMgjX6pisBjREezxKs7YU7GsH8AJTnoM8OEtYleXaAqkCb0 TknU/1hPAhzieduSDsiaS7joLlvVuG8fiSiFwUV6IfT7SChlbp7meEoMLh+LpjTpAW6kG SBU5q+2Z92TO/3lnDbsz42/E/0xJA4D4Rg1zcZtsd7x5+4je8JVlWX4vcFZbRteuliw== 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=VkX4MeZZ; 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 D7DA4606D835; Sat, 7 Nov 2026 01:45:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D7DA4606D835 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, unprotected) header.d=efficios.com header.i=@efficios.com header.a=rsa-sha256 header.s=smtpout1 header.b=VkX4MeZZ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1794015902; bh=dZbFr4HtjBuZjWke0zFqxqxv4leAjWoAN7JaAi457w0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkX4MeZZ6K+V54VQNgkvoKLgtRKvMyac9aP/k5ZILlDNRPyGMHUWAQYVBJ79W+/em mk0A2qGh0fSZDkjS7cfImXm0f6ahez6hSt53HRsYkbTPC/YSvCAXjaO8TOOl+mvJyJ 5AY6AUGcwZdEirWdqrggCMGwNmEJQhXlpJCcSA5g9I1zla0sx42lel1RRRLUyp6jkk Jv4jM6e3KQZNd0sSAylvNce2sD5okmG2uTCjrbUZKnXJchTs7a4oAxEZvrL6sl/Rit dkQhgb4JZusWKgxHPjwZt4D1tjPF/mu/iX4nZsysYFmhZNerfNkSz+Ej8ISTnYWrsy NLM5pn/ZsJFPA== Received: from thinkos.internal.efficios.com (unknown [64.58.40.251]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4jLzPn6RsCzMR5; Fri, 06 Nov 2026 20:45:01 -0500 (EST) From: Mathieu Desnoyers To: juri.lelli@redhat.com, peterz@infradead.org, mingo@redhat.com, vincent.guittot@linaro.org Cc: linux-kernel@vger.kernel.org, Mathieu Desnoyers , tglx@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, 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, cgroups@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-rt-devel@lists.linux.dev, stable@vger.kernel.org Subject: [PATCH v4 09/26] sched/deadline: Reset the deadline and the runtime with the parameters Date: Fri, 6 Nov 2026 20:44:34 -0500 Message-Id: <20261107014451.1487825-10-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20261107014451.1487825-1-mathieu.desnoyers@efficios.com> References: <20261107014451.1487825-1-mathieu.desnoyers@efficios.com> 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 keeps its parameters until its 0-lag time, so that leaving and coming back gains nothing. __dl_clear_params() then resets them, in inactive_task_timer() or in task_non_contending(), but leaves the deadline and the runtime of the period the task was in. A task that comes back after its 0-lag time, and before that deadline, is enqueued on them: enqueue_dl_entity() starts a period anew for a task whose deadline passed, setup_new_dl_entity(), and for no other. The task spends the runtime of the reservation it gave back before the new one begins, and a constrained task whose deadline passed before the end of its period is throttled on them instead, dl_check_constrained_dl() arming the replenishment timer of the old period. The previous patch widens the window to a period for a task that was throttled, moving its deadline on where its timer fires outside the class. A task boosted into the class by priority inheritance, with no parameters of its own, runs on the donor's deadline and runtime, and keeps them after its deboost: switched_from_dl() resets nothing for it, and a change into the class before that deadline is enqueued on them as well. Reset them with the parameters, and on the deboost of a task that has none: the next enqueue then starts a period from the parameters the task has. The deadline_bw_test selftest added later in this series has the case, deboost_resets_period. Found by the Sashiko AI review of the second posting of this series, the deboost by that of the third. Fixes: 209a0cbda7a0 ("sched/deadline: Improve the tracking of active utilization") Cc: stable@vger.kernel.org Signed-off-by: Mathieu Desnoyers --- kernel/sched/deadline.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index b8b0076870a6..f389620e6fc9 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -3580,6 +3580,16 @@ static void switched_from_dl(struct rq *rq, struct task_struct *p) if (task_on_rq_queued(p) && p->dl.dl_runtime) task_non_contending(&p->dl, false); + /* + * Deboosted from priority inheritance with no parameters of its own: + * the deadline and the runtime are the donor's. A change into the + * class then starts a period from the parameters it is given. + */ + if (!p->dl.dl_runtime) { + p->dl.deadline = 0; + p->dl.runtime = 0; + } + /* * In case a task is setscheduled out from SCHED_DEADLINE we need to * keep track of that on its cpuset (for correct bandwidth tracking). @@ -4006,6 +4016,9 @@ static void __dl_clear_params(struct sched_dl_entity *dl_se) dl_se->dl_bw = 0; dl_se->dl_density = 0; + dl_se->deadline = 0; + dl_se->runtime = 0; + dl_se->dl_throttled = 0; dl_se->dl_yielded = 0; dl_se->dl_non_contending = 0; -- 2.47.3