From: Li kunyu <likunyu@open-hieco.net>
To: Qais Yousef <qyousef@layalina.io>, Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>
Cc: Juri Lelli <juri.lelli@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
John Stultz <jstultz@google.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Tim Chen <tim.c.chen@linux.intel.com>,
"Chen, Yu C" <yu.c.chen@intel.com>,
Thomas Gleixner <tglx@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 03/10] sched/pelt: Add a new function to approximate runtime to reach given util
Date: Thu, 26 Nov 2026 18:50:00 +0800 [thread overview]
Message-ID: <e64956eb-393e-6fa7-3351-acffa4ee779e@open-hieco.net> (raw)
In-Reply-To: <20261126051429.14091-4-qyousef@layalina.io>
Hi Qais,
On 2026/11/26 13:14, Qais Yousef wrote:
> +
> +/*
> + * Approximate the required amount of runtime in us required to reach @util.
> + */
> +u64 approximate_runtime(unsigned long util)
> +{
> + struct sched_avg sa = {};
> + u64 delta = 1024; // period = 1024 = ~1ms
Would it be clearer to name this period as the base unit? A delta of 1024
corresponds to one full period:
u64 period = 1024; /* one period = 1024 delta units */
> + u64 runtime = 0;
> +
> + if (unlikely(!util))
> + return runtime;
> +
> + if (unlikely(WARN_ON_ONCE(util > SCHED_CAPACITY_SCALE)))
> + util = SCHED_CAPACITY_SCALE;
> +
> + while (sa.util_avg < util) {
> + accumulate_sum(delta, &sa, 1, 0, 1);
accumulate_sum(period, &sa, 1, 0, 1);
> + ___update_load_avg(&sa, 0);
> + runtime++;
> + }
> +
> + return runtime * 1024;
return runtime * period;
> +}
Would the overall effect be better this way? Or is my understanding somewhat off?
--
thanks,
kunyu
next prev parent reply other threads:[~2026-11-26 10:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 5:14 [PATCH v3 00/10] Better manage system response time Qais Yousef
2026-11-26 5:14 ` [PATCH v3 01/10] sched: cpufreq: Rename map_util_perf to sugov_apply_dvfs_headroom Qais Yousef
2026-11-26 5:14 ` [PATCH v3 02/10] sched/pelt: Add a new function to approximate the future util_avg value Qais Yousef
2026-11-26 5:14 ` [PATCH v3 03/10] sched/pelt: Add a new function to approximate runtime to reach given util Qais Yousef
2026-11-26 10:50 ` Li kunyu [this message]
2026-11-26 5:14 ` [PATCH v3 04/10] sched/fair: Remove magic hardcoded margin in fits_capacity() Qais Yousef
2026-11-26 5:14 ` [PATCH v3 05/10] sched: cpufreq: Remove magic 1.25 headroom from sugov_apply_dvfs_headroom() Qais Yousef
2026-11-26 5:14 ` [PATCH v3 06/10] sched/fair: Extend util_est to improve rampup time Qais Yousef
2026-11-26 5:14 ` [PATCH v3 07/10] sched/fair: util_est: Take into account periodic tasks Qais Yousef
2026-11-26 5:14 ` [PATCH v3 08/10] sched/debugfs: Add rampup_multiplier to debugfs Qais Yousef
2026-11-26 5:14 ` [PATCH v3 09/10] sched/fair: Disable util_est when rampup_multiplier is 0 Qais Yousef
2026-11-26 5:14 ` [PATCH v3 10/10] sched/fair: Don't mess with util_avg post init 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=e64956eb-393e-6fa7-3351-acffa4ee779e@open-hieco.net \
--to=likunyu@open-hieco.net \
--cc=dietmar.eggemann@arm.com \
--cc=jstultz@google.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=qyousef@layalina.io \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@kernel.org \
--cc=tim.c.chen@linux.intel.com \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=yu.c.chen@intel.com \
/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
all inboxes | Powered by JetHome®