[PATCH] sched/deadline: Always stop dl-server before changing parameters

Juri Lelli posted 1 patch 2 months, 2 weeks ago
There is a newer version of this series
kernel/sched/debug.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
[PATCH] sched/deadline: Always stop dl-server before changing parameters
Posted by Juri Lelli 2 months, 2 weeks ago
Commit cccb45d7c4295 ("sched/deadline: Less agressive dl_server
handling") reduced dl-server overhead by delaying disabling servers only
after there are no fair task around for a whole period, which means that
deadline entities are not dequeued right away on a server stop event.
However, the delay opens up a window in which a request for changing
server parameters can break per-runqueue running_bw tracking, as
reported by Yuri.

Close the problematic window by unconditionally calling dl_server_stop()
before applying the new parameters (ensuring deadline entities go
through an actual dequeue).

Fixes: cccb45d7c4295 ("sched/deadline: Less agressive dl_server handling")
Reported-by: Yuri Andriaccio <yurand2000@gmail.com>
Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
---
 kernel/sched/debug.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 3f06ab84d53f0..02e16b70a7901 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -376,10 +376,8 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu
 			return  -EINVAL;
 		}
 
-		if (rq->cfs.h_nr_queued) {
-			update_rq_clock(rq);
-			dl_server_stop(&rq->fair_server);
-		}
+		update_rq_clock(rq);
+		dl_server_stop(&rq->fair_server);
 
 		retval = dl_server_apply_params(&rq->fair_server, runtime, period, 0);
 		if (retval)

---
base-commit: ed0272f0675f31642c3d445a596b544de9db405b
change-id: 20250721-upstream-fix-dlserver-lessaggressive-b4-c5af242d3083

Best regards,
--  
Juri Lelli <juri.lelli@redhat.com>
Re: [PATCH] sched/deadline: Always stop dl-server before changing parameters
Posted by Valentin Schneider 1 month, 2 weeks ago
On 21/07/25 15:01, Juri Lelli wrote:
> Commit cccb45d7c4295 ("sched/deadline: Less agressive dl_server
> handling") reduced dl-server overhead by delaying disabling servers only
> after there are no fair task around for a whole period, which means that
> deadline entities are not dequeued right away on a server stop event.
> However, the delay opens up a window in which a request for changing
> server parameters can break per-runqueue running_bw tracking, as
> reported by Yuri.
>
> Close the problematic window by unconditionally calling dl_server_stop()
> before applying the new parameters (ensuring deadline entities go
> through an actual dequeue).
>
> Fixes: cccb45d7c4295 ("sched/deadline: Less agressive dl_server handling")
> Reported-by: Yuri Andriaccio <yurand2000@gmail.com>
> Signed-off-by: Juri Lelli <juri.lelli@redhat.com>

Reviewed-by: Valentin Schneider <vschneid@redhat.com>