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

From: Quentin Perret
Date: Fri Jan 17 2020 - 06:40:53 EST


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.

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 ?

Thanks,
Quentin