Skip to content

Commit 68ec89d

Browse files
Joel FernandesPeter Zijlstra
authored andcommitted
sched/debug: Stop and start server based on if it was active
Currently the DL server interface for applying parameters checks CFS-internals to identify if the server is active. This is error-prone and makes it difficult when adding new servers in the future. Fix it, by using dl_server_active() which is also used by the DL server code to determine if the DL server was started. Signed-off-by: Joel Fernandes <joelagnelf@nvidia.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Juri Lelli <juri.lelli@redhat.com> Reviewed-by: Andrea Righi <arighi@nvidia.com> Acked-by: Tejun Heo <tj@kernel.org> Tested-by: Christian Loehle <christian.loehle@arm.com> Link: https://patch.msgid.link/20260126100050.3854740-4-arighi@nvidia.com
1 parent 6080fb2 commit 68ec89d

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

kernel/sched/debug.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu
348348
return err;
349349

350350
scoped_guard (rq_lock_irqsave, rq) {
351+
bool is_active;
352+
351353
runtime = rq->fair_server.dl_runtime;
352354
period = rq->fair_server.dl_period;
353355

@@ -370,16 +372,19 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu
370372
return -EINVAL;
371373
}
372374

373-
update_rq_clock(rq);
374-
dl_server_stop(&rq->fair_server);
375+
is_active = dl_server_active(&rq->fair_server);
376+
if (is_active) {
377+
update_rq_clock(rq);
378+
dl_server_stop(&rq->fair_server);
379+
}
375380

376381
retval = dl_server_apply_params(&rq->fair_server, runtime, period, 0);
377382

378383
if (!runtime)
379384
printk_deferred("Fair server disabled in CPU %d, system may crash due to starvation.\n",
380385
cpu_of(rq));
381386

382-
if (rq->cfs.h_nr_queued)
387+
if (is_active && runtime)
383388
dl_server_start(&rq->fair_server);
384389

385390
if (retval < 0)

0 commit comments

Comments
 (0)