Re: [PATCH v4] sched/fair: unlink misfit task from cpu overutilized

From: Dietmar Eggemann
Date: Tue Jan 31 2023 - 11:36:29 EST


On 29/01/2023 17:21, Qais Yousef wrote:
> On 01/26/23 12:42, Dietmar Eggemann wrote:
>> On 19/01/2023 17:42, Vincent Guittot wrote:

[...]

>> We had already this discussion whether this patch can also remove
>> Capacity Inversion (CapInv).
>>
>> After studying the code again, I'm not so sure anymore.
>>
>> This patch:
>>
>> (1) adds a dedicated return value (-1) to util_fits_cpu() when:
>>
>> `util fits 80% capacity_of() && util < uclamp_min && uclamp_min >
>> capacity_orig_thermal (region c)`
>>
>> (2) Enhancements to the CPU selection in sic() and feec() to cater for
>> this new return value.
>
> -1 means that the task fits, but only uclamp_min hint fails. ie: the task util
> is small enough to run on this cpu, but it would like to run faster and this
> cpu can't satisfy this request at the moment.

Agreed.

>> IMHO this doesn't make the intention of CapInv in util_fits_cpu()
>> obsolete, which is using:
>>
>> in CapInv:
>>
>> capacity_orig = capacity_orig_of() - thermal_load_avg
>> capacity_orig_thermal = capacity_orig_of() - thermal_load_avg
>>
>> not in CapInv:
>>
>> capacity_orig = capacity_orig_of()
>> capacity_orig_thermal = capacity_orig_of() - th_pressure
>>
>> Maybe I still miss a bit of the story?
>
> Vincent approach is different to mine. I tried to hide all the complexity in
> util_fits_cpu() so all users don't care.
>
> But with Vincent changes, now the decision is delegated to the caller to decide
> what to do if thermal pressure is causing trouble.
>
> IOW, I expect this line only stay after Vincent patch
>
> capacity_orig_thermal = capacity_orig_of() - th_pressure

OK, makes sense (for now - rework of what capacity_orig_thermal should
really be still ahead of us).

Thanks!

-- Dietmar

[...]