Re: [PATCH] fix share rt runtime with offline rq

From: Peter Zijlstra
Date: Wed Jan 08 2020 - 08:02:49 EST


On Mon, Dec 23, 2019 at 11:40:30AM -0500, Steven Rostedt wrote:
> > kernel/sched/rt.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> > index a532558..d20dc86 100644
> > --- a/kernel/sched/rt.c
> > +++ b/kernel/sched/rt.c
> > @@ -648,8 +648,12 @@ static void do_balance_runtime(struct rt_rq *rt_rq)
> > rt_period = ktime_to_ns(rt_b->rt_period);
> > for_each_cpu(i, rd->span) {
> > struct rt_rq *iter = sched_rt_period_rt_rq(rt_b, i);
> > + struct rq *rq = rq_of_rt_rq(iter);
> > s64 diff;
> >
> > + if (!rq->online)
> > + continue;
> > +
>
> I think this might be papering over the real issue. Perhaps
> rq_offline_rt() needs to be called for CPUs not being brought online?

Yeah, very much that. Something like the below perhaps. But I really
want to rip out the whole RT_CGROUP_SCHED stuff so we can start over.

Perhaps the poster can explain what he's using this stuff for?

---
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 4043abe45459..96a0320cfadb 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -208,7 +208,13 @@ int alloc_rt_sched_group(struct task_group *tg, struct task_group *parent)
goto err_free_rq;

init_rt_rq(rt_rq);
+
+ cpus_read_lock();
rt_rq->rt_runtime = tg->rt_bandwidth.rt_runtime;
+ if (!cpu_online(i))
+ rt_rq->rt_runtime = RUNTIME_INF;
+ cpus_read_unlock();
+
init_tg_rt_entry(tg, rt_rq, rt_se, i, parent->rt_se[i]);
}