On 06-12-22, 10:10, Lukasz Luba wrote:
> The max CPU capacity is the same for all CPUs sharing frequency domain
> and thus 'policy' object. There is a way to avoid heavy operations
> in a loop for each CPU by leveraging this knowledge. Thus, simplify
> the looping code in the sugov_next_freq_shared() and drop heavy
> multiplications. Instead, use simple max() to get the highest utilization
> from these CPUs. This is useful for platforms with many (4 or 6) little
> CPUs.
>
> The max CPU capacity must be fetched every time we are called, due to
> difficulties during the policy setup, where we are not able to get the
> normalized CPU capacity at the right time.
>
> The stored value in sugov_policy::max is also than used in
> sugov_iowait_apply() to calculate the right boost. Thus, that field is
> useful to have in that sugov_policy struct.
>
> Signed-off-by: Lukasz Luba <[email protected]>
Can you please divide this into two patches, one for just moving max
and one for looping optimization ? Else we may end up reverting
everything once again.
--
viresh
On 12/6/22 10:16, Viresh Kumar wrote:
> On 06-12-22, 10:10, Lukasz Luba wrote:
>> The max CPU capacity is the same for all CPUs sharing frequency domain
>> and thus 'policy' object. There is a way to avoid heavy operations
>> in a loop for each CPU by leveraging this knowledge. Thus, simplify
>> the looping code in the sugov_next_freq_shared() and drop heavy
>> multiplications. Instead, use simple max() to get the highest utilization
>> from these CPUs. This is useful for platforms with many (4 or 6) little
>> CPUs.
>>
>> The max CPU capacity must be fetched every time we are called, due to
>> difficulties during the policy setup, where we are not able to get the
>> normalized CPU capacity at the right time.
>>
>> The stored value in sugov_policy::max is also than used in
>> sugov_iowait_apply() to calculate the right boost. Thus, that field is
>> useful to have in that sugov_policy struct.
>>
>> Signed-off-by: Lukasz Luba <[email protected]>
>
> Can you please divide this into two patches, one for just moving max
> and one for looping optimization ? Else we may end up reverting
> everything once again.
>
OK, I can do that. Thanks for having a look!
On Tue, Dec 6, 2022 at 11:30 AM Lukasz Luba <[email protected]> wrote:
>
>
>
> On 12/6/22 10:16, Viresh Kumar wrote:
> > On 06-12-22, 10:10, Lukasz Luba wrote:
> >> The max CPU capacity is the same for all CPUs sharing frequency domain
> >> and thus 'policy' object. There is a way to avoid heavy operations
> >> in a loop for each CPU by leveraging this knowledge. Thus, simplify
> >> the looping code in the sugov_next_freq_shared() and drop heavy
> >> multiplications. Instead, use simple max() to get the highest utilization
> >> from these CPUs. This is useful for platforms with many (4 or 6) little
> >> CPUs.
> >>
> >> The max CPU capacity must be fetched every time we are called, due to
> >> difficulties during the policy setup, where we are not able to get the
> >> normalized CPU capacity at the right time.
> >>
> >> The stored value in sugov_policy::max is also than used in
> >> sugov_iowait_apply() to calculate the right boost. Thus, that field is
> >> useful to have in that sugov_policy struct.
> >>
> >> Signed-off-by: Lukasz Luba <[email protected]>
> >
> > Can you please divide this into two patches, one for just moving max
> > and one for looping optimization ? Else we may end up reverting
> > everything once again.
> >
>
> OK, I can do that. Thanks for having a look!
Also, please note that this material is unlikely to go into 6.2, so
I'd prefer going back to it after 6.2-rc1 is out.
On 12/6/22 11:00, Rafael J. Wysocki wrote:
> On Tue, Dec 6, 2022 at 11:30 AM Lukasz Luba <[email protected]> wrote:
>>
>>
>>
>> On 12/6/22 10:16, Viresh Kumar wrote:
>>> On 06-12-22, 10:10, Lukasz Luba wrote:
>>>> The max CPU capacity is the same for all CPUs sharing frequency domain
>>>> and thus 'policy' object. There is a way to avoid heavy operations
>>>> in a loop for each CPU by leveraging this knowledge. Thus, simplify
>>>> the looping code in the sugov_next_freq_shared() and drop heavy
>>>> multiplications. Instead, use simple max() to get the highest utilization
>>>> from these CPUs. This is useful for platforms with many (4 or 6) little
>>>> CPUs.
>>>>
>>>> The max CPU capacity must be fetched every time we are called, due to
>>>> difficulties during the policy setup, where we are not able to get the
>>>> normalized CPU capacity at the right time.
>>>>
>>>> The stored value in sugov_policy::max is also than used in
>>>> sugov_iowait_apply() to calculate the right boost. Thus, that field is
>>>> useful to have in that sugov_policy struct.
>>>>
>>>> Signed-off-by: Lukasz Luba <[email protected]>
>>>
>>> Can you please divide this into two patches, one for just moving max
>>> and one for looping optimization ? Else we may end up reverting
>>> everything once again.
>>>
>>
>> OK, I can do that. Thanks for having a look!
>
> Also, please note that this material is unlikely to go into 6.2, so
> I'd prefer going back to it after 6.2-rc1 is out.
Yes, I understand. Thanks Rafael!