From: Lukasz Luba <lukasz.luba@arm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
rafael@kernel.org, dietmar.eggemann@arm.com,
vincent.guittot@linaro.org, saravanak@google.com,
wusamuel@google.com, isaacmanjarres@google.com,
kernel-team@android.com, juri.lelli@redhat.com,
peterz@infradead.org, mingo@redhat.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de
Subject: Re: [PATCH v3 1/1] cpufreq: schedutil: Optimize operations with single CPU capacity lookup
Date: Fri, 9 Dec 2022 08:39:10 +0000 [thread overview]
Message-ID: <e8f4f0d0-d071-e169-48c2-02081c840583@arm.com> (raw)
In-Reply-To: <20221208233801.s26awslkx6aloxyd@vireshk-i7>
On 12/8/22 23:38, Viresh Kumar wrote:
> On 08-12-22, 16:02, Lukasz Luba wrote:
>> @@ -332,12 +333,15 @@ static void sugov_update_single_freq(struct update_util_data *hook, u64 time,
>> struct sugov_cpu *sg_cpu = container_of(hook, struct sugov_cpu, update_util);
>> struct sugov_policy *sg_policy = sg_cpu->sg_policy;
>> unsigned int cached_freq = sg_policy->cached_raw_freq;
>> + unsigned long max_cap;
>> unsigned int next_f;
>>
>> - if (!sugov_update_single_common(sg_cpu, time, flags))
>> + max_cap = arch_scale_cpu_capacity(sg_cpu->cpu);
>
> I will rather do this at all three locations:
>
> unsigned long max_cap = arch_scale_cpu_capacity(sg_cpu->cpu);
>
In the 2nd location it is called after the check:
if (!arch_scale_freq_invariant())
which can return.
IMO this is more visible and exposed.
The way it's implemented now stresses the fact that
we read this value at runtime (unfortunately). Maybe in the
future someone would find it and simplify.
I sometimes found difficult to spot those important calls in
the variable header section, e.g. how many times are called
or with what kind of arguments. In this case the sg_cpu->cpu
should be clearly visible and effectively matched as the same as
smp_procesor_id() for that running CPU, thus fetching the
same capacity variable from local per-cpu (not remote).
IMO the way how the code is structured could help (or not)
to spot those details. That's why I prefer to keep it as is
in this implementation.
next prev parent reply other threads:[~2022-12-09 8:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-08 16:02 [PATCH v3 0/1] cpufreq: schedutil: Optimize operations in hot path frequency switch Lukasz Luba
2022-12-08 16:02 ` [PATCH v3 1/1] cpufreq: schedutil: Optimize operations with single CPU capacity lookup Lukasz Luba
2022-12-08 23:38 ` Viresh Kumar
2022-12-09 8:39 ` Lukasz Luba [this message]
2023-01-07 10:53 ` [tip: sched/core] cpufreq, sched/util: " tip-bot2 for Lukasz Luba
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=e8f4f0d0-d071-e169-48c2-02081c840583@arm.com \
--to=lukasz.luba@arm.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=isaacmanjarres@google.com \
--cc=juri.lelli@redhat.com \
--cc=kernel-team@android.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=saravanak@google.com \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=wusamuel@google.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®