Re: [Patch v5 1/6] sched/pelt.c: Add support to track thermal pressure

From: Dietmar Eggemann
Date: Wed Nov 06 2019 - 07:50:26 EST


On 05/11/2019 19:49, Thara Gopinath wrote:
> Extrapolating on the exisiting framework to track rt/dl utilization using

s/exisiting/existing

> pelt signals, add a similar mechanism to track thermal pressure. The
> difference here from rt/dl utilization tracking is that, instead of
> tracking time spent by a cpu running a rt/dl task through util_avg,
> the average thermal pressure is tracked through load_avg. This is
> because thermal pressure signal is weighted "delta" capacity
> and is not binary(util_avg is binary). "delta capacity" here
> means delta between the actual capacity of a cpu and the decreased
> capacity a cpu due to a thermal event.
> In order to track average thermal pressure, a new sched_avg variable
> avg_thermal is introduced. Function update_thermal_load_avg can be called
> to do the periodic bookeeping (accumulate, decay and average)

s/bookeeping/bookkeeping

> of the thermal pressure.
>
> Signed-off-by: Thara Gopinath <thara.gopinath@xxxxxxxxxx>
> ---
> kernel/sched/pelt.c | 13 +++++++++++++
> kernel/sched/pelt.h | 7 +++++++
> kernel/sched/sched.h | 1 +
> 3 files changed, 21 insertions(+)
>
> diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
> index a96db50..3821069 100644
> --- a/kernel/sched/pelt.c
> +++ b/kernel/sched/pelt.c
> @@ -353,6 +353,19 @@ int update_dl_rq_load_avg(u64 now, struct rq *rq, int running)
> return 0;
> }

Minor thing: There are function headers for rt_rq, dl_rq and irq. rt_rq
even explains that 'load_avg and runnable_load_avg are not supported and
meaningless.' Could you do something similar for thermal here? It's not
self-explanatory why we track load_avg, runnable_load_avg and util_avg
for thermal but only use load_avg.

> +int update_thermal_load_avg(u64 now, struct rq *rq, u64 capacity)
> +{
> + if (___update_load_sum(now, &rq->avg_thermal,
> + capacity,
> + capacity,
> + capacity)) {
> + ___update_load_avg(&rq->avg_thermal, 1, 1);
> + return 1;
> + }
> +
> + return 0;
> +}
> +

[...]