linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qais Yousef <qyousef@layalina.io>
To: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	Lukasz Luba <lukasz.luba@arm.com>
Subject: Re: [RFC PATCH 1/7] sched/pelt: Add a new function to approximate the future util_avg value
Date: Sat, 16 Sep 2023 20:49:23 +0100	[thread overview]
Message-ID: <20230916194923.4sijts6a56jxbava@airbuntu> (raw)
In-Reply-To: <45548b21-280e-7f94-0b53-f2dcab6ccb5e@arm.com>

On 09/13/23 19:22, Dietmar Eggemann wrote:
> 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().

You mean *not* call, or actually *do* call ___update_load_avg() if delta
< 1024? I am certainly not calling it now and I think you're suggesting to
actually call it when period is less than 1024.

This area is not my strength, so I do sure appreciate any suggestion to make it
better! :-) I will look into that for next version.


Many thanks!

--
Qais Yousef

  reply	other threads:[~2023-09-16 19:50 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-27 23:31 [RFC PATCH 0/7] sched: cpufreq: Remove magic margins Qais Yousef
2023-08-27 23:31 ` [RFC PATCH 1/7] sched/pelt: Add a new function to approximate the future util_avg value Qais Yousef
2023-09-06 12:56   ` Dietmar Eggemann
2023-09-06 21:19     ` Qais Yousef
2023-09-07 11:12       ` Dietmar Eggemann
2023-09-10 19:58         ` Qais Yousef
2023-09-13 17:22           ` Dietmar Eggemann
2023-09-16 19:49             ` Qais Yousef [this message]
2023-09-16 19:52               ` Qais Yousef
2023-08-27 23:31 ` [RFC PATCH 2/7] sched/pelt: Add a new function to approximate runtime to reach given util Qais Yousef
2023-09-06 12:56   ` Dietmar Eggemann
2023-09-06 20:44     ` Dietmar Eggemann
2023-09-06 21:38       ` Qais Yousef
2023-09-15  9:15   ` Hongyan Xia
2023-09-16 19:56     ` Qais Yousef
2023-08-27 23:31 ` [RFC PATCH 3/7] sched/fair: Remove magic margin in fits_capacity() Qais Yousef
2023-09-06 14:38   ` Dietmar Eggemann
2023-09-06 21:45     ` Qais Yousef
2023-08-27 23:32 ` [RFC PATCH 4/7] sched: cpufreq: Remove magic 1.25 headroom from apply_dvfs_headroom() Qais Yousef
2023-09-07 11:34   ` Peter Zijlstra
2023-09-10 19:23     ` Qais Yousef
2023-08-27 23:32 ` [RFC PATCH 5/7] sched/schedutil: Add a new tunable to dictate response time Qais Yousef
2023-09-06 21:13   ` Dietmar Eggemann
2023-09-06 21:52     ` Qais Yousef
2023-09-07 11:44   ` Peter Zijlstra
2023-09-10 19:25     ` Qais Yousef
2023-08-27 23:32 ` [RFC PATCH 6/7] sched/pelt: Introduce PELT multiplier Qais Yousef
2023-08-27 23:32 ` [RFC PATCH 7/7] cpufreq: Change default transition delay to 2ms Qais Yousef
2023-09-06  9:18 ` [RFC PATCH 0/7] sched: cpufreq: Remove magic margins Lukasz Luba
2023-09-06 21:18   ` Qais Yousef
2023-09-07  7:48     ` Lukasz Luba
2023-09-07 11:53       ` Peter Zijlstra
2023-09-07 13:06         ` Lukasz Luba
2023-09-07 13:29           ` Peter Zijlstra
2023-09-07 13:33             ` Lukasz Luba
2023-09-07 13:38               ` Peter Zijlstra
2023-09-07 13:45                 ` Lukasz Luba
2023-09-08 12:51                   ` Daniel Bristot de Oliveira
2023-09-12 11:57                     ` Lukasz Luba
2023-09-10 18:20         ` Qais Yousef
2023-09-10 18:14       ` Qais Yousef
2023-09-07 13:26     ` Peter Zijlstra
2023-09-07 13:57       ` Lukasz Luba
2023-09-07 14:29         ` Peter Zijlstra
2023-09-07 14:42           ` Lukasz Luba
2023-09-07 20:16             ` Peter Zijlstra
2023-09-12 11:51               ` Lukasz Luba
2023-09-12 14:01                 ` Vincent Guittot
2023-09-13  9:53                   ` Lukasz Luba
2023-09-12 14:28                 ` Peter Zijlstra
2023-09-10 19:06             ` Qais Yousef
2023-09-10 18:46       ` Qais Yousef
2023-09-07 13:08 ` Peter Zijlstra
2023-09-08  0:17   ` Qais Yousef
2023-09-08  7:40     ` Dietmar Eggemann
2023-09-08 14:07       ` Qais Yousef
2023-09-12 17:18         ` Dietmar Eggemann
2023-09-16 19:38           ` Qais Yousef
2023-09-08 10:25     ` Peter Zijlstra
2023-09-08 13:33       ` Qais Yousef
2023-09-08 13:58         ` Peter Zijlstra
2023-09-08 13:59         ` Peter Zijlstra
2023-09-08 14:11           ` Qais Yousef
2023-09-10 21:17         ` Qais Yousef

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230916194923.4sijts6a56jxbava@airbuntu \
    --to=qyousef@layalina.io \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rafael@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).