Commit 68ec89d0 authored by Joel Fernandes's avatar Joel Fernandes Committed by Peter Zijlstra
Browse files

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: default avatarJoel Fernandes <joelagnelf@nvidia.com>
Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: default avatarJuri Lelli <juri.lelli@redhat.com>
Reviewed-by: default avatarAndrea Righi <arighi@nvidia.com>
Acked-by: default avatarTejun Heo <tj@kernel.org>
Tested-by: default avatarChristian Loehle <christian.loehle@arm.com>
Link: https://patch.msgid.link/20260126100050.3854740-4-arighi@nvidia.com
parent 6080fb21
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -348,6 +348,8 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu
		return err;

	scoped_guard (rq_lock_irqsave, rq) {
		bool is_active;

		runtime  = rq->fair_server.dl_runtime;
		period = rq->fair_server.dl_period;

@@ -370,8 +372,11 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu
			return  -EINVAL;
		}

		is_active = dl_server_active(&rq->fair_server);
		if (is_active) {
			update_rq_clock(rq);
			dl_server_stop(&rq->fair_server);
		}

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

@@ -379,7 +384,7 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu
			printk_deferred("Fair server disabled in CPU %d, system may crash due to starvation.\n",
					cpu_of(rq));

		if (rq->cfs.h_nr_queued)
		if (is_active && runtime)
			dl_server_start(&rq->fair_server);

		if (retval < 0)