Re: [PATCH V2] sched: fair: Use the earliest break even

From: Daniel Lezcano
Date: Tue Mar 17 2020 - 09:59:41 EST


On 17/03/2020 11:56, Valentin Schneider wrote:
>
> Hi Daniel,
>
> One more comment on the break even itself, ignoring the rest:
>
> On Wed, Mar 11 2020, Daniel Lezcano wrote:
>> diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
>> index b743bf38f08f..3342e7bae072 100644
>> --- a/kernel/sched/idle.c
>> +++ b/kernel/sched/idle.c
>> @@ -19,7 +19,13 @@ extern char __cpuidle_text_start[], __cpuidle_text_end[];
>> */
>> void sched_idle_set_state(struct cpuidle_state *idle_state)
>> {
>> - idle_set_state(this_rq(), idle_state);
>> + struct rq *rq = this_rq();
>> +
>> + idle_set_state(rq, idle_state);
>> +
>> + if (idle_state)
>> + idle_set_break_even(rq, ktime_get_ns() +
>> + idle_state->exit_latency_ns);
>
> I'm not sure I follow why we go for entry time + exit latency. If this
> is based on the minimum residency, shouldn't this be something depending
> on the entry latency? i.e. something like
>
> break_even = now + entry_latency + idling_time
> \_________________________/
> min-residency
>
> or am I missing something?
Oh, no it is a stupid mistake from me. Thanks for pointing this out!

It should be:

break_even = now + idle_state->target_residency_ns;

- Documentation/devicetree/bindings/arm/idle-states.yaml

* min-residency: Minimum period, including preparation and entry, for a
given idle state to be worthwhile energywise.

(target_residency_ns == min-residency).

>
>> }
>>
>> static int __read_mostly cpu_idle_force_poll;


--
<http://www.linaro.org/> Linaro.org â Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog