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=1796309996; b=KW84hjBFcCX98BRU6hN8fWsqMlCd+bfUJR9t1LBjU594hhnV+Y7jACiGyM+4SW6VZNK1 9+pY4YLih6izlCKslsJXvkqmFNPUrCZm1Tg5W4b09qhX/EZlg2jTg4788yq4IdXF7kgUQ 74a0oRLwtnDlpV3/+gz3Xl+Xl/Ari1+hv/csr7U3hfGKMCqLvVlixs213cHfZYo3fTV2q RT3LCApK1UFfjIoxVq67hagFJDQE/A8PjSlwQhU6nfzLSqJucXPJGEOEEW3aF3eCfyxEt +YvQ6+IfL7E+MT6guMgXaBrx+Pp4nCu6OAsDiM1duzo+t7SD54T9PqgGfA8brbrD3/Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796309996; 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=TrOyGhbcQ3OMGwc1/g4qM7CqQGs66WGlvx4kLxNqwH8=; b=VvlL8uhjIQJg+9zzWCq1OHfOZSsF3bQQ1VH5lcBC20SMM1Tc+BVG6NdFqogbB1nrO2GG YC+BImH86LvGf9Xq1jVnYjvF1Au09QVBS+0MKDkn/NMYaPSdFP51UQk4rENDtD9l6nJ61 TWP8NveI9AcjCrZ4YPD5YgIK2u8C+Twy5gnf66wZKx24OFlniXgfz7PI3qNwhi9VIhd5Y LQ4bjybE+zat2nzk5aHDx2o1s+wCVYcS/6hjvGrQUEcnf18worSWQ3U/CpU8dxHdWDDlR dwTsiEfDCKmgVoA/1Nwf5zOVf0lGNV8BdJ2Ip4Pvv0d+SOy+poVf5uHjglSeeIuDZxQ== 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=GvW1L5+C; 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 1D8AC606EBE6; Thu, 3 Dec 2026 14:59:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1D8AC606EBE6 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=GvW1L5+C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=smtpout1; t=1796309995; bh=TrOyGhbcQ3OMGwc1/g4qM7CqQGs66WGlvx4kLxNqwH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GvW1L5+CZ1ZsOOQkhsAslIl0GRRIGOJ4vclV+zVTfrd7aDyufg9ZEvB50RW/xOqds cTy47ssj9adQ7/n+Yqq2P1Ih+8P+0W6AiUd+MEfu6Bmd3Zhxusu5ghpgoXZh4ClA3O pz8ofcDfSZivWsYhNPd05mrs9bvXnrRL5V3EC4YIV5FUsm6Xn5ml882HPF1e7Gz7Q5 yjIYQiluZk+cv7MmW/OO8HGH38SdOYRmCoMhr7eIXDpVUKaxQLjQhzx8LpXFzNX70Z tP+JUoTNnDrdwdAXI6FQZ6GGxnVzNA2++fThKZzmqxl6awE3xqIkJbyCNAz6EGe15d oqy4ARV+WdvGw== Received: from thinkos.internal.efficios.com (unknown [IPv6:2605:8d80:7180:6739:ac39:5d4:4093:61c6]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4jgHpx5pQ5zZlH; Thu, 03 Dec 2026 09:59:53 -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 30/39] sched/deadline: Check the runtime of a task that comes back runnable Date: Thu, 3 Dec 2026 09:58:44 -0500 Message-ID: <4d4f0e1117d434b648f14009cf5321d90a56ee99.1796296313.git.mathieu.desnoyers@efficios.com> 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 Commit a649f237db18 ("sched,dl: Fix sched class hopping CBS hole") keeps the runtime and the deadline of a task that leaves SCHED_DEADLINE. A task that comes back before its deadline goes on with them. So leaving the class and coming back gives no new runtime. But the task can come back with new parameters. If it is asleep, its wakeup checks the runtime left against them, with dl_entity_overflow(). If it is runnable, enqueue_dl_entity() starts a new period only if the deadline has passed. The runtime left is not checked. So a task can come back with a smaller runtime, and still run on the old one. Admission control counts only the new one. Juri Lelli found this case. On v7.4-rc2, a task of 50ms every 100ms came back through SCHED_OTHER with 10ms every 100ms. It ran 39ms of the next 100ms. Fix this by applying the wakeup rule to a task that enters the class runnable, with update_dl_entity(). It starts a new period, or reduces the runtime of a constrained task, if the runtime left does not fit the new parameters. The task gets no more than a wakeup would give it. The return_running_new_params case, added to deadline_bw_test later in this series, tests this. It fails on v7.4-rc2 and passes with this patch. The return_asleep_new_params case tests the wakeup, and passes on both. Fixes: a649f237db18 ("sched,dl: Fix sched class hopping CBS hole") Reported-by: Juri Lelli Closes: https://lore.kernel.org/all/avHvPjz4dL0zNyGb@jlelli-thinkpadt14gen4.remote.csb/ Signed-off-by: Mathieu Desnoyers Cc: stable@vger.kernel.org --- kernel/sched/deadline.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index e71960d70f23..58fc1c6c4117 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -2894,6 +2894,14 @@ enqueue_dl_entity(struct sched_dl_entity *dl_se, int flags) update_dl_entity(dl_se); } else if (flags & ENQUEUE_REPLENISH) { replenish_dl_entity(dl_se); + } else if ((flags & ENQUEUE_CLASS) && !is_dl_boosted(dl_se)) { + /* + * The task enters the class runnable. It may come back before + * its deadline, with the runtime left from older parameters. + * Check that runtime against the new parameters, as a wakeup + * does. + */ + update_dl_entity(dl_se); } else if ((flags & ENQUEUE_MOVE) && !is_dl_boosted(dl_se) && dl_time_before(dl_se->deadline, rq_clock(rq_of_dl_se(dl_se)))) { -- 2.47.3