Re: [Patch v4 2/6] sched: Add infrastructure to store and update instantaneous thermal pressure

Dietmar Eggemann
2019-11-04T17:29:31Z

On 01/11/2019 21:57, Thara Gopinath wrote:
> On 11/01/2019 08:17 AM, Dietmar Eggemann wrote:
>> On 22.10.19 22:34, Thara Gopinath wrote:
>>
>> [...]
>>
>>> +/**
>>> + * trigger_thermal_pressure_average: Trigger the thermal pressure accumulate
>>> + * and average algorithm
>>> + */
>>> +void trigger_thermal_pressure_average(struct rq *rq)
>>> +{
>>> + update_thermal_load_avg(rq_clock_task(rq), rq,
>>> + per_cpu(delta_capacity, cpu_of(rq)));
>>> +}
>>
>> Why not call update_thermal_load_avg() directly in fair.c? We do this for all
>> the other update_foo_load_avg() functions (foo eq. irq, rt_rq, dl_rq ...)
> thermal.c is going away in next version and I am moving everything to
> fair.c. So this is taken care of
>
>>
>> You don't have to pass 'u64 now', so you can hide it plus the
>
> You still need now.All the update_*_avg apis take now as a parameter.

You do need it for the ___update_load_sum() call inside the
foo_load_avg() functions. But that doesn't mean you have to pass it into
foo_load_avg(). Look at update_irq_load_avg() for example. We don't pass
rq->clock as now in there.

-int update_thermal_load_avg(u64 now, struct rq *rq, u64 capacity)
+extern int sched_thermal_decay_coeff;
+
+int update_thermal_load_avg(struct rq *rq, u64 capacity)
{
+ u64 now = rq_clock_task(rq) >> sched_thermal_decay_coeff;
+
if (___update_load_sum(now, &rq->avg_thermal,
capacity,
capacity,