Re: [Patch v8 4/7] sched/fair: Enable periodic update of average thermal pressure

From: Vincent Guittot
Date: Fri Jan 17 2020 - 08:17:51 EST


On Fri, 17 Jan 2020 at 13:31, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Fri, Jan 17, 2020 at 11:40:45AM +0000, Quentin Perret wrote:
> > On Thursday 16 Jan 2020 at 16:15:02 (+0100), Peter Zijlstra wrote:
> > > > @@ -10275,6 +10281,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
> > > > {
> > > > struct cfs_rq *cfs_rq;
> > > > struct sched_entity *se = &curr->se;
> > > > + unsigned long thermal_pressure = arch_cpu_thermal_pressure(cpu_of(rq));
> > > >
> > > > for_each_sched_entity(se) {
> > > > cfs_rq = cfs_rq_of(se);
> > > > @@ -10286,6 +10293,7 @@ static void task_tick_fair(struct rq *rq, struct task_struct *curr, int queued)
> > > >
> > > > update_misfit_status(curr, rq);
> > > > update_overutilized_status(task_rq(curr));
> > > > + update_thermal_load_avg(rq_clock_task(rq), rq, thermal_pressure);
> > > > }
> > >
> > > I'm thinking this is the wrong place; should this not be in
> > > scheduler_tick(), right before calling sched_class::task_tick() ? Surely
> > > any execution will affect thermals, not only fair class execution.
> >
> > Right, but right now only CFS takes action when we overheat. That is,
> > only CFS uses capacity_of() which is where the thermal signal gets
> > reflected.
>
> Sure, but we should still track the thermals unconditionally, even if
> only CFS consumes it.

I agree, tracking thermal pressure should happen even if no cfs task are running

>
> > We definitely could (and maybe should) make RT and DL react to thermal
> > pressure as well when they're both capacity-aware. But perhaps that's
> > for later ? Thoughts ?
>
> Yeah, that's later head-aches. Even determining what to do there, except
> panic() is going to be 'interesting'.