The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>
Cc: linux-rt-devel@lists.linux.dev, tj@kernel.org,
	hannes@cmpxchg.org, mkoutny@suse.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 23/33] sched/deadline: Reset the donor's runtime at a deboost in the class
Date: Thu, 19 Nov 2026 20:53:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-224059@kernel.org> (raw)
In-Reply-To: <a6b2af72b10e67a5865158280c3955e4f8169a24.1795116791.git.mathieu.desnoyers@efficios.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] sched/deadline: missing dl_note_donor_refill() in
  replenish_dl_entity()
- [Medium] sched/deadline: dl_entity_preempt() precedes dl_deboost() in
  rt_mutex_setprio()
--

commit 99ad044e86f7c0f67e987d30b947babfc918e9b4
Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>

sched/deadline: Reset the donor's runtime at a deboost in the class

This commit tracks whether a boosted deadline entity had its runtime
refilled from its donor's reservation via a new dl_donor_refill flag, and
starts a new period from the task's own parameters when the boost ends in
SCHED_DEADLINE.

> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index fe2919be3775b..781eff6455250 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7957,16 +7957,26 @@ void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task)
>  				p->dl.pi_se = pi_task->dl.pi_se;
>  				scope->flags |= ENQUEUE_REPLENISH;
>  			} else {
> -				p->dl.pi_se = &p->dl;
> +				dl_deboost(&p->dl);
> +				/*
> +				 * dl_deboost() can start a new period. Its
> +				 * deadline can then be after the top waiter's.
> +				 * Boost the task again then.
> +				 */
> +				if (pi_task && dl_prio(pi_task->prio) &&
> +				    dl_entity_preempt(&pi_task->dl, &p->dl)) {
> +					p->dl.pi_se = pi_task->dl.pi_se;
> +					scope->flags |= ENQUEUE_REPLENISH;
> +				}
>  			}

[Severity: Medium]
Can a SCHED_DEADLINE task keep a departed donor's refilled runtime and
deadline when switching to another deadline top waiter?

Before this else branch, rt_mutex_setprio() checks
dl_entity_preempt(&pi_task->dl, &p->dl) against p->dl.deadline.  If a
previous donor refilled p (setting p->dl.dl_donor_refill = 1) and pushed
p->dl.deadline past the next waiter pi_task->dl.deadline, that outer
check succeeds and skips dl_deboost(&p->dl).  Because p->dl.dl_deadline
is non-zero and p->dl.runtime can still be positive from the previous
donor's refill, ENQUEUE_REPLENISH in replenish_dl_entity() does not reset
p->dl.runtime or p->dl.deadline, leaving p running with the previous
donor's remaining runtime and postponed deadline.

Calling dl_deboost(&p->dl) before testing dl_entity_preempt(&pi_task->dl,
&p->dl) for dl_prio(p->normal_prio) tasks would also avoid duplicating
the re-boost check in the else branch.

[ ... ]

> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 914915abb912d..66a1150c4811a 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c

[ ... ]

> @@ -1150,6 +1187,7 @@ static void replenish_dl_entity(struct sched_dl_entity *dl_se)
>  		if (!dl_se->dl_deadline) {
>  			dl_se->deadline = rq_clock(rq);
>  			dl_se->runtime = 0;
> +			dl_note_donor_refill(dl_se);
>  		}
>  		if (dl_se->runtime < 0 || dl_se->dl_yielded)
>  			dl_se->runtime = 0;

[Severity: Medium]
Should the (dl_se->runtime < 0 || dl_se->dl_yielded) path also call
dl_note_donor_refill(dl_se)?

When a boosted SCHED_DEADLINE task (dl_se->dl_deadline != 0) exhausts its
runtime or yields after its donor's parameters have been cleared, this
branch clamps dl_se->runtime to 0 and clears dl_se->dl_throttled without
recording the refill.  At deboost, dl_deboost() sees
dl_se->dl_donor_refill == 0 and leaves the task queued with
dl_se->runtime == 0, so it throttles on the next tick instead of starting
a new period with its own reservation.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795116790.git.mathieu.desnoyers@efficios.com?part=23

  reply	other threads:[~2026-11-19 20:53 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 20:15 [PATCH v8 00/33] sched/deadline: bandwidth accounting fixes and selftests Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 01/33] sched/deadline: Keep departing bandwidth across a root domain rebuild Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 02/33] sched/deadline: Rebuild the root domains' accounting from the task list Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 03/33] sched/deadline: Record the root domain holding a task's bandwidth Mathieu Desnoyers
2026-11-19 20:51   ` sashiko-bot
2026-11-19 20:15 ` [PATCH v8 04/33] sched/deadline: Leave a dying task out of a rebuild of the accounting Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 05/33] selftests/sched: Test SCHED_DEADLINE bandwidth across a root domain rebuild Mathieu Desnoyers
2026-11-19 20:28   ` sashiko-bot
2026-11-19 20:15 ` [PATCH v8 06/33] selftests/sched: Test the root domain rebuild in deadline_bw_test Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 07/33] sched/deadline: Move a task's bandwidth only where room was made Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 08/33] cgroup/cpuset: Wait for an attach before rebuilding the sched domains Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 09/33] sched: Make deadline policy and affinity changes wait for a cpuset attach Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 10/33] cgroup/cpuset: Give back the bandwidth an attach did not move Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 11/33] cgroup/cpuset: Reserve the bandwidth in the root domain a task moves to Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 12/33] selftests/sched: Test cpuset moves in deadline_bw_test Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 13/33] sched/deadline: Make a rebuild count a task in the root domain it runs in Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 14/33] sched/deadline: Move a task's bandwidth to " Mathieu Desnoyers
2026-11-19 20:53   ` sashiko-bot
2026-11-19 20:15 ` [PATCH v8 15/33] sched/deadline: Keep a task in the root domain that counts its bandwidth Mathieu Desnoyers
2026-11-19 20:55   ` sashiko-bot
2026-11-19 20:15 ` [PATCH v8 16/33] sched/deadline: Keep the last CPU a task has in its root domain Mathieu Desnoyers
2026-11-19 20:22   ` Mathieu Desnoyers
2026-11-19 20:48   ` sashiko-bot
2026-11-19 20:15 ` [PATCH v8 17/33] cgroup/cpuset: Refuse to take a deadline task out of " Mathieu Desnoyers
2026-11-19 20:43   ` sashiko-bot
2026-11-19 20:15 ` [PATCH v8 18/33] selftests/sched: Test the root domain of a task in deadline_bw_test Mathieu Desnoyers
2026-11-19 20:27   ` sashiko-bot
2026-11-19 20:15 ` [PATCH v8 19/33] sched/deadline: Count only active CPUs when spreading extra_bw Mathieu Desnoyers
2026-11-19 20:15 ` [PATCH v8 20/33] rtmutex: Continue the chain walk when a waiter's deadline donor changes Mathieu Desnoyers
2026-11-19 20:16 ` [PATCH v8 21/33] rtmutex: Continue the walk when the owner's top waiter changes lock Mathieu Desnoyers
2026-11-19 20:16 ` [PATCH v8 22/33] selftests/sched: Test the rtmutex chain walk in deadline_bw_test Mathieu Desnoyers
2026-11-19 20:16 ` [PATCH v8 23/33] sched/deadline: Reset the donor's runtime at a deboost in the class Mathieu Desnoyers
2026-11-19 20:53   ` sashiko-bot [this message]
2026-11-19 20:16 ` [PATCH v8 24/33] sched/deadline: Replenish a throttled task boosted while asleep Mathieu Desnoyers
2026-11-19 20:16 ` [PATCH v8 25/33] sched/deadline: Count the bandwidth a boosted task is given Mathieu Desnoyers
2026-11-19 20:16 ` [PATCH v8 26/33] sched/deadline: Start a period for a task that enters the class blocked Mathieu Desnoyers
2026-11-19 20:57   ` sashiko-bot
2026-11-19 20:16 ` [PATCH v8 27/33] sched/deadline: Start a period at a deboost out of the class Mathieu Desnoyers
2026-11-19 20:47   ` sashiko-bot
2026-11-19 20:16 ` [PATCH v8 28/33] selftests/sched: Test deadline boosts in deadline_bw_test Mathieu Desnoyers
2026-11-19 20:16 ` [PATCH v8 29/33] sched/deadline: Cancel the replenishment timer with the parameters Mathieu Desnoyers
2026-11-19 20:16 ` [PATCH v8 30/33] sched/deadline: Cap the runtime left of a constrained task at dl_runtime Mathieu Desnoyers
2026-11-19 20:16 ` [PATCH v8 31/33] sched/deadline: Check the runtime of a task that comes back runnable Mathieu Desnoyers
2026-11-19 20:16 ` [PATCH v8 32/33] sched/deadline: Check the runtime of a task whose parameters change Mathieu Desnoyers
2026-11-19 20:59   ` sashiko-bot
2026-11-19 20:16 ` [PATCH v8 33/33] selftests/sched: Test parameter changes in deadline_bw_test Mathieu Desnoyers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-224059@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mkoutny@suse.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox