Skip to contentSkip to conversation

sched/deadline: Use revised wakeup rule only for running dl_server

PATCH Applied Gabriele Monaco 6 participants 9 messages May 22 – Jul 30 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched/deadline: Use revised wakeup rule only for running dl_server

Commit 14a857056466 ("sched/deadline: Use revised wakeup rule for dl_server") applies the revised wakeup rule to any server, as a result servers that are not running (dl_defer_running == 0) and start with a deadline overflow get enqueued and can boost tasks as if they were running, invalidating the defer rule and the documented state model.

Apply the revised wakeup rule only for deferrable servers that are marked as running.

Fixes 14a857056466 ("sched/deadline: Use revised wakeup rule for dl_server")

---

Tested with ksched_football on a 16 CPUs machine: no regression (1s for check in and game over in 10s).

Apparently the rt_stall sched_ext selftest does fail with tasks not always getting above 4% (almost always above 3%). But that seems to be the case also before this change on that machine.

---
 kernel/sched/deadline.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/deadline.c +2 -1
index 7db4c87df83b..e5a7701a8af7 100644
@@ -1017,7 +1017,8 @@ static void update_dl_entity(struct sched_dl_entity *dl_se)
 	if (dl_time_before(dl_se->deadline, rq_clock(rq)) ||
 	    dl_entity_overflow(dl_se, rq_clock(rq))) {
 
-		if (unlikely((!dl_is_implicit(dl_se) || dl_se->dl_defer) &&
+		if (unlikely((!dl_is_implicit(dl_se) ||
+			      (dl_se->dl_defer && dl_se->dl_defer_running)) &&
 			     !dl_time_before(dl_se->deadline, rq_clock(rq)) &&
 			     !is_dl_boosted(dl_se))) {
 			update_dl_revised_wakeup(dl_se, rq);

base-commit: 8bc67e4db64aa72732c474b44ea8622062c903f0

Signature · 1 line
2.54.0
Tested-by on v1 1/1
#1 lore raw

Hi Garbiele,

Quoted 11 lines · Gabriele Monaco

Commit 14a857056466 ("sched/deadline: Use revised wakeup rule for dl_server") applies the revised wakeup rule to any server, as a result servers that are not running (dl_defer_running == 0) and start with a deadline overflow get enqueued and can boost tasks as if they were running, invalidating the defer rule and the documented state model.

Apply the revised wakeup rule only for deferrable servers that are marked as running.

Fixes 14a857056466 ("sched/deadline: Use revised wakeup rule for dl_server")
Quoted 8 lines

---

Tested with ksched_football on a 16 CPUs machine: no regression (1s for check in and game over in 10s).

Apparently the rt_stall sched_ext selftest does fail with tasks not always getting above 4% (almost always above 3%). But that seems to be the case also before this change on that machine.

Yeah the rt_stall selftest can be a bit flaky sometimes, as long as you get >3% it's all good, maybe we should relax the min threshold a bit. In any case, I tested this and it looks good om my side.

Thanks,
-Andrea

Quoted 24 lines
---
 kernel/sched/deadline.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/deadline.c +2 -1
index 7db4c87df83b..e5a7701a8af7 100644
@@ -1017,7 +1017,8 @@ static void update_dl_entity(struct sched_dl_entity *dl_se)
 	if (dl_time_before(dl_se->deadline, rq_clock(rq)) ||
 	    dl_entity_overflow(dl_se, rq_clock(rq))) {
 
-		if (unlikely((!dl_is_implicit(dl_se) || dl_se->dl_defer) &&
+		if (unlikely((!dl_is_implicit(dl_se) ||
+			      (dl_se->dl_defer && dl_se->dl_defer_running)) &&
 			     !dl_time_before(dl_se->deadline, rq_clock(rq)) &&
 			     !is_dl_boosted(dl_se))) {
 			update_dl_revised_wakeup(dl_se, rq);

base-commit: 8bc67e4db64aa72732c474b44ea8622062c903f0

Signature · 1 line
2.54.0
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Gabriele Monaco

Hi!

Quoted 6 lines · Gabriele Monaco

Commit 14a857056466 ("sched/deadline: Use revised wakeup rule for dl_server") applies the revised wakeup rule to any server, as a result servers that are not running (dl_defer_running == 0) and start with a deadline overflow get enqueued and can boost tasks as if they were running, invalidating the defer rule and the documented state model.

Quoted 6 lines

Apply the revised wakeup rule only for deferrable servers that are marked as running.

Fixes 14a857056466 ("sched/deadline: Use revised wakeup rule for dl_server")

---

Makes sense to me.

Thanks,
Juri

#6 lore raw
Quoted 6 lines · Peter Zijlstra
Quoted 3 lines · Gabriele Monaco

Peter,

could you take this patch?

Yes, just back from holidays, so immense backlog. sched/urgent this?

I'd say so, thanks!

Tested-by on v1 1/1
#7 lore raw
In reply to Gabriele Monaco
Quoted 10 lines · Gabriele Monaco

Commit 14a857056466 ("sched/deadline: Use revised wakeup rule for dl_server") applies the revised wakeup rule to any server, as a result servers that are not running (dl_defer_running == 0) and start with a deadline overflow get enqueued and can boost tasks as if they were running, invalidating the defer rule and the documented state model.

Apply the revised wakeup rule only for deferrable servers that are marked as running.

Quoted 7 lines
Fixes 14a857056466 ("sched/deadline: Use revised wakeup rule for dl_server")

---

Tested with ksched_football on a 16 CPUs machine: no regression (1s for check in and game over in 10s).

Yeah, I double checked in my environment and I'm not seeing any trouble with the ksched_football startup on my 64 vcpu guest I test with.

[   61.150605] ksched_football: Started referee, game_time: 10 secs !
[   62.407743] ksched_football: All players checked in! Starting game.

thanks
-john

#8 lore raw
In reply to Gabriele Monaco
The following commit has been merged into the sched/urgent branch of tip:

The following commit has been merged into the sched/urgent branch of tip:

Commit-ID:     1842bf97af109f5ebf830175c9725bf81ebb78b1
Gitweb:        https://git.kernel.org/tip/1842bf97af109f5ebf830175c9725bf81ebb78b1
Author:        Gabriele Monaco <[email protected]>
AuthorDate:    Fri, 22 May 2026 14:58:33 +02:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Thu, 30 Jul 2026 12:59:23 +02:00

sched/deadline: Use revised wakeup rule only for running dl_server

Commit 14a857056466 ("sched/deadline: Use revised wakeup rule for dl_server") applies the revised wakeup rule to any server, as a result servers that are not running (dl_defer_running == 0) and start with a deadline overflow get enqueued and can boost tasks as if they were running, invalidating the defer rule and the documented state model.

Apply the revised wakeup rule only for deferrable servers that are marked as running.

---
 kernel/sched/deadline.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/sched/deadline.c +2 -1
index 0f858b9..2003000 100644
@@ -1017,7 +1017,8 @@ static void update_dl_entity(struct sched_dl_entity *dl_se)
 	if (dl_time_before(dl_se->deadline, rq_clock(rq)) ||
 	    dl_entity_overflow(dl_se, rq_clock(rq))) {
 
-		if (unlikely((!dl_is_implicit(dl_se) || dl_se->dl_defer) &&
+		if (unlikely((!dl_is_implicit(dl_se) ||
+			      (dl_se->dl_defer && dl_se->dl_defer_running)) &&
 			     !dl_time_before(dl_se->deadline, rq_clock(rq)) &&
 			     !is_dl_boosted(dl_se))) {
 			update_dl_revised_wakeup(dl_se, rq);