Re: [PATCH 02/11] sched/debug: Stop and start server based on if it was active

Juri Lelli
2025-11-07T06:51:59Z

On 06/11/25 17:39, Andrea Righi wrote:
> On Thu, Nov 06, 2025 at 08:13:39AM +0100, Juri Lelli wrote:

...

> > > @@ -376,8 +378,11 @@ static ssize_t sched_fair_server_write(struct file *filp, const char __user *ubu
> > > return -EINVAL;
> > > }
> > >
> > > - update_rq_clock(rq);
> > > - dl_server_stop(&rq->fair_server);
> > > + 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);
> > >
> > > @@ -385,7 +390,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)
> > > dl_server_start(&rq->fair_server);
> >
> > Something that I noticed while reviewing this series is that we still
> > start back a server even if the user put its runtime to zero (disabling
> > it) and I don't think we want to do that. It's not of course related to
> > this change or this series per-se, but something we probably want to fix
> > independently.
>
> Should we just call dl_server_remove_params() when runtime is zero?

Looking again at it I actually wonder if wouldn't it be better to use
dl_server_apply_params(dl_se, 0, dl_se->dl_period, false) in both cases.
dl_rq_change_utilization() deals with dl_non_contending (inactive_timer
armed) case already (even though sub-optimally, but we can fix/change it
later), so we can probably remove the special handling you do in
dl_server_remove_params(). The WARN_ON_ONCE(on_dl_rq()) could be moved
to dl_server_apply_params() as well.

What do you think?