Re: [PATCH v12 25/43] sched/deadline: Count the 0-lag time from the next period
From: Juri Lelli
Date: Mon Nov 30 2026 - 11:47:17 EST
Hello,
On 27/11/26 09:35, Mathieu Desnoyers wrote:
...
> Fix this by counting the 0-lag time from the next period, with
> dl_next_period(). Update the formula in
> Documentation/scheduler/sched-deadline.rst too.
...
> @@ -1756,7 +1764,7 @@ static inline void dl_check_constrained_dl(struct sched_dl_entity *dl_se)
> {
> struct rq *rq = rq_of_dl_se(dl_se);
>
> - if (dl_time_before(dl_se->deadline, rq_clock(rq)) &&
> + if (dl_se->deadline && dl_time_before(dl_se->deadline, rq_clock(rq)) &&
> dl_time_before(rq_clock(rq), dl_next_period(dl_se))) {
> if (unlikely(is_dl_boosted(dl_se) || !start_dl_timer(dl_se)))
> return;
Nit: the patch also makes dl_check_constrained_dl() skip a task with no
period yet (deadline of 0), which could otherwise be taken for one in
its constrained gap right after boot. That isn't obvious from the code,
so maybe a comment before the check, something like
/*
* A deadline of 0 means the task has no period yet: this enqueue
* starts one. Skip it, or the check below would see a deadline in
* the past and, while rq_clock is still below dl_period (right
* after boot), throttle the task until a next period computed
* from that 0.
*/
and a sentence in the changelog?
Apart from that, this fix maybe should go at the top of the series so
that it can be picked up more easily?
Reviewed-by: Juri Lelli <juri.lelli@xxxxxxxxxx>
Thanks,
Juri