From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796314853; b=4lKS1TkQnHTmGa3slHUidHgu0wtYMQe4Q25dlHdwG8c6lSlVBpOJFxQKkxXxfP3MYjs3 ro7W8E62OPFihC9kuHma6ju0+OEqM1O5A2oyBxqOueYdW4JeVsBior8+tYuNsdQ930MhT ycZ8Lz3UleCFSLKYl0Bvy0GCG0Bk860pWpNwkLrNSrdnSn1y1O0DxWRiNKEstLs6EFHrt a/6N8doJgyQ7yNJngzdrfPKvi7cmRHN8Se1JaGlC1Wdkio3XZ6+JZz7CLD18SA1pO+MNU CmCR/eruW6xCUUzORmJCVGAWiZBJU3K4oaCr/eBMfF2lCFsFfllUIAstWqh2SKZGFtg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796314853; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=apZzq3eR2cjpES4RH+c6ydvCEzisv7fNUal3LMRnQKs=; b=ZZmKtTJR8RbndEzZwQPlSCg4wuGa+3UiLxRYOEK3jKNf6HROAIqeAXIA6nHQy6/ft2iF fVoVk8TgWf2XW5oY+Q/saFVlqyf85JI15ms9ivelZeY8jnYrYRo8zWrCXky/aT9C7GqyF WVe3Ay9aO1O8yY6GYSChPZFjoG0daozGcOOAX0Hv/PkjgEDTlgRjbbw7tKwK9+gHUgO4p BYRucSRmT6tP05eOCkUE4WT1eCyD7IaySJPCC3LQNWitk1dmBOxkpLkrSOl1NeJbSOg1x wPOU+jXukSwLz9eyXa5aDL2HCAR28D1K8te2SFNRxmefXDE6MW8pVOsSEf4XffhWpHA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=V6b5L1cO; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.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 1F98C606A322; Thu, 3 Dec 2026 16:20:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=V6b5L1cO Received: by smtp.kernel.org (Postfix) with ESMTPSA id 732831F00893; Thu, 3 Dec 2026 16:20:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796314852; bh=apZzq3eR2cjpES4RH+c6ydvCEzisv7fNUal3LMRnQKs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=V6b5L1cOWpXBh2y05CCQz0koNN4R33CeT7EZ4VDurCkXl2lTgV07XrHviAx9TAlr1 Bb1bVH4jO/F0tIL5CpXcwe7fyCFYcWbR5y2HcusYOGP2eIeRGdNUEfbVmiPkGVk/yW qIidEY0UfYVGB+BCRQinoOS8fZLtI2OFPidUJ7zKowK+CcSyqBHyhEnV56S9sh1M+e TPYIJXLGFqxa9zJCYdwgiFw4OmaJME96aaVrJtoSHwy0a6ra0uggMSonJDIgGp+1KB bfT3JvSalBS6rHd7Mohr/aW3otRokDrbnTQmIHfQUSOpd5Nw3dPK97epFK355b8/+w fkseuifeUMCfA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v14 12/39] sched/deadline: Leave a dying task out of a rebuild of the accounting Reply-To: sashiko-reviews@lists.linux.dev To: "Mathieu Desnoyers" Cc: linux-rt-devel@lists.linux.dev, tj@kernel.org, hannes@cmpxchg.org, mkoutny@suse.com, linux-kernel@vger.kernel.org In-Reply-To: <850691678744bca537b969748aa6a45a2837b400.1796296313.git.mathieu.desnoyers@efficios.com> References: <850691678744bca537b969748aa6a45a2837b400.1796296313.git.mathieu.desnoyers@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 16:20:52 +0000 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] sched/deadline: double dl_release_params() wipes constrained deadline -- commit e4f9d3bf8a229c9738af54b6d2c8666c12642fa7 Author: Mathieu Desnoyers sched/deadline: Leave a dying task out of a rebuild of the accounting This commit skips dead deadline tasks with no recorded dl_bw_cpu in dl_add_task_root_domain() so a root domain rebuild does not re-count bandwidth that was already released before dl_bw was cleared. > diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c > index 03a6699151cfe..fc0f32a7f80ac 100644 > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c > @@ -3861,6 +3861,17 @@ void dl_add_task_root_domain(struct task_struct *p) > if (recorded < 0 || !cpu_active(recorded)) > goto unlock; > cpu =3D recorded; > + } else if (READ_ONCE(p->__state) =3D=3D TASK_DEAD && p->dl.dl_bw_cpu < = 0) { > + /* > + * Count nothing for a dead task with no record. Its last > + * schedule released the bandwidth under its rq lock, and has > + * not cleared dl_bw yet. The release clears the record under > + * dl_departed_lock, which this walk holds. A dead task with a > + * record has not reached its last schedule. Count it as a > + * live task. That schedule then releases what the walk > + * counted, or puts the task on the departed list. > + */ > + goto unlock; > } > rq =3D cpu_rq(cpu); > dl_b =3D &rq->rd->dl_bw; [Severity: Medium] In commit "sched/deadline: Keep the deadline of a departed constrained task", can a second call to dl_release_params() wipe the preserved dl_se->deadline of a constrained-deadline task? When a constrained-deadline task has an armed inactive_timer that starts running on CPU1 (making hrtimer_active() return true) before acquiring task_rq_lock(), CPU0 can wake or PI-boost the task and leave SCHED_DEADLINE via switched_from_dl() -> task_non_contending() first: CPU0 CPU1 inactive_task_timer() (hrtimer_active() is true) switched_from_dl() task_non_contending(..., false) hrtimer_active() -> true dl_task_release_bw(p) dl_release_params(dl_se) __dl_clear_params(dl_se) dl_se->deadline =3D deadline task_rq_lock(p, &rf) !dl_task(p) -> true dl_task_release_bw(p) dl_release_params(dl_se) dl_is_implicit() -> true (0 =3D=3D = 0) __dl_clear_params(dl_se) <-- dl_se->deadline wiped to 0 On the second call to dl_release_params(), dl_deadline and dl_period are both 0, so dl_is_implicit() evaluates to true and __dl_clear_params() overwrites the preserved dl_se->deadline with 0. If the task re-enters SCHED_DEADLINE before its next period, it bypasses dl_check_constrained_dl() throttling and can consume more than its admitted bandwidth, potentially causing other deadline tasks to miss deadlines. Returning early from dl_release_params() when dl_se->dl_runtime is already 0 would avoid wiping the preserved deadline. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/cover.1796296313.gi= t.mathieu.desnoyers@efficios.com?part=3D12