[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <45548b21-280e-7f94-0b53-f2dcab6ccb5e@arm.com>
Date: Wed, 13 Sep 2023 19:22:10 +0200
From: Dietmar Eggemann <dietmar.eggemann@....com>
To: Qais Yousef <qyousef@...alina.io>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
Vincent Guittot <vincent.guittot@...aro.org>,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
Lukasz Luba <lukasz.luba@....com>
Subject: Re: [RFC PATCH 1/7] sched/pelt: Add a new function to approximate the
future util_avg value
On 10/09/2023 21:58, Qais Yousef wrote:
> On 09/07/23 13:12, Dietmar Eggemann wrote:
>> On 06/09/2023 23:19, Qais Yousef wrote:
>>> On 09/06/23 14:56, Dietmar Eggemann wrote:
>>>> On 28/08/2023 01:31, Qais Yousef wrote:
[...]
>> Another thing ... I guess if you call accumulate_sum with delta the PELT
>> machinery assumes `delta = now - sa->last_update_time` which means you
>> would have to use `clock_pelt + TICK_USEC` as delta.
>
> Right.
>
> The way I understood it is that at TICK we should do update_load_avg() which
> would call __update_load_sum() which uses
>
> delta = now - sa->last_update_time
>
> which passes this delta to accumulate_sum()
>
> I can see we are not very accurate since there will be a small additional time
> besides TICK_USEC that we are not accounting for. But I can't see how this can
> cause a big error.
>
> predicted (assumed) tick time/delta
>
> sa->last_update_time = now
> tick_time = TICK_USEC + now
>
> delta = tick_time - sa->last_update_time
> delta = TICK_USEC + now - now
> delta = TICK_USEC
>
> but actual tick time/delta
>
> sa->last_update_time = now - x
> tick_time = TICK_USEC + now
>
> delta = tick_time - sa->last_update_time
> delta = TICK_USEC + now - (now - x)
> delta = TICK_USEC + x
>
> So the delta I am using might be slightly shorter than it should be.
>
> IIUC, what you're saying that the `x` in my equation above is clock_pelt,
> right?
No, I was wrong here. Calling accumulate_sum with `delta = TICK_USEC` is
fine.
accumulate_sum() will accrue `sa->util.sum` and ___update_load_avg()
will then adjust `sa->util_avg` accordingly.
delta should be 4000 on Arm64 boards so you will cross period
boundaries. In case `delta < 1024` you might want to not call
___update_load_avg() to be in pair with __update_load_avg_cfs_rq().
Powered by blists - more mailing lists