Re: [Patch v4 4/6] sched/fair: update cpu_capcity to reflect thermal pressure

From: Dietmar Eggemann
Date: Thu Oct 31 2019 - 12:44:49 EST


On 31.10.19 17:31, Vincent Guittot wrote:
> On Thu, 31 Oct 2019 at 17:17, Dietmar Eggemann <dietmar.eggemann@xxxxxxx> wrote:
>>
>> On 31.10.19 16:48, Vincent Guittot wrote:
>>> On Thu, 31 Oct 2019 at 16:38, Dietmar Eggemann <dietmar.eggemann@xxxxxxx> wrote:
>>>>
>>>> On 31.10.19 11:53, Qais Yousef wrote:
>>>>> On 10/28/19 16:30, Peter Zijlstra wrote:
>>>>>> On Wed, Oct 23, 2019 at 01:28:40PM +0100, Qais Yousef wrote:
>>>>>>> On 10/22/19 16:34, Thara Gopinath wrote:

[...]

>>>> diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
>>>> index 38210691c615..d3035457483f 100644
>>>> --- a/kernel/sched/pelt.c
>>>> +++ b/kernel/sched/pelt.c
>>>> @@ -357,9 +357,9 @@ 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);
>>>> + 0,
>>>> + 0)) {
>>>> + ___update_load_avg(&rq->avg_thermal, 1, 0);
>>>> return 1;
>>>> }
>>
>> So we could call it this way since we don't care about runnable_load or
>> util?
>
> one way or the other is quite similar but the current solution is
> aligned with other irq, rt, dl signals which duplicates the same state
> in each fields

I see. But there is a subtle difference. For irq, rt, dl, we have to
also set load (even we only use util) because of:

___update_load_sum() {

...
if (!load)
runnable = running = 0;
...
}

which is there for se's only.

I like self-explanatory code but I agree in this case it's not obvious.