From: Lukasz Luba <lukasz.luba@arm.com>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Sam Wu <wusamuel@google.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Valentin Schneider <vschneid@redhat.com>,
Saravana Kannan <saravanak@google.com>,
"Isaac J . Manjarres" <isaacmanjarres@google.com>,
kernel-team@android.com,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] Revert "cpufreq: schedutil: Move max CPU capacity to sugov_policy"
Date: Tue, 6 Dec 2022 08:17:05 +0000 [thread overview]
Message-ID: <d38e1cba-23f1-a19d-54dd-b9e18e852bee@arm.com> (raw)
In-Reply-To: <20221205091830.pttdbyts4hujkpq2@vireshk-i7>
Hi Viresh,
On 12/5/22 09:18, Viresh Kumar wrote:
> Lukasz,
>
> On 10-11-22, 19:57, Sam Wu wrote:
>> diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c
>> index 9161d1136d01..1207c78f85c1 100644
>> --- a/kernel/sched/cpufreq_schedutil.c
>> +++ b/kernel/sched/cpufreq_schedutil.c
>> @@ -25,9 +25,6 @@ struct sugov_policy {
>> unsigned int next_freq;
>> unsigned int cached_raw_freq;
>>
>> - /* max CPU capacity, which is equal for all CPUs in freq. domain */
>> - unsigned long max;
>> -
>> /* The next fields are only needed if fast switch cannot be used: */
>> struct irq_work irq_work;
>> struct kthread_work work;
>> @@ -51,6 +48,7 @@ struct sugov_cpu {
>>
>> unsigned long util;
>> unsigned long bw_dl;
>> + unsigned long max;
>
> IIUC, this part, i.e. moving max to sugov_policy, wasn't the problem
> here, right ? Can you send a patch for that at least first, since this
> is fully reverted now.
>
> Or it doesn't make sense?
>
Yes, that still could make sense. We could still optimize a bit that
code in the sugov_next_freq_shared(). Look at that function. It loops
over all CPUs in the policy and calls sugov_get_util() which calls
this arch_scale_cpu_capacity() N times. Then it does those
multiplications below:
if (j_util * max > j_max * util)
which will be 2*N mul operations...
IMO this is pointless and heavy for LITTLE cores which are 4 or
sometimes 6 in the policy.
As you could see, my code just left that loop with a simple
max() operation.
I might just attack this code differently. Switch to that
sugov_policy::max, fetch the cpu capacity only once, before that loop.
I will rewrite a bit the sugov_get_util() and adjust the
2nd user of it: sugov_update_single_common()
Regards,
Lukasz
prev parent reply other threads:[~2022-12-06 8:19 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-10 19:57 [PATCH v1] Revert "cpufreq: schedutil: Move max CPU capacity to sugov_policy" Sam Wu
2022-11-15 22:35 ` Saravana Kannan
2022-11-16 11:43 ` Lukasz Luba
2022-11-16 12:17 ` Rafael J. Wysocki
2022-11-18 1:00 ` Sam Wu
2022-11-21 19:18 ` Rafael J. Wysocki
2022-11-22 8:58 ` Lukasz Luba
2022-11-30 10:42 ` Vincent Guittot
2022-11-30 14:04 ` Lukasz Luba
2022-11-30 14:29 ` Vincent Guittot
2022-11-30 15:00 ` Lukasz Luba
2022-11-16 11:35 ` Lukasz Luba
2022-11-20 18:07 ` [PATCH v1] Revert "cpufreq: schedutil: Move max CPU capacity to sugov_policy" #forregzbot Thorsten Leemhuis
2022-11-27 12:06 ` Thorsten Leemhuis
2022-12-05 9:18 ` [PATCH v1] Revert "cpufreq: schedutil: Move max CPU capacity to sugov_policy" Viresh Kumar
2022-12-06 8:17 ` Lukasz Luba [this message]
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=d38e1cba-23f1-a19d-54dd-b9e18e852bee@arm.com \
--to=lukasz.luba@arm.com \
--cc=bristot@redhat.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.j.wysocki@intel.com \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=saravanak@google.com \
--cc=vincent.guittot@linaro.org \
--cc=viresh.kumar@linaro.org \
--cc=vschneid@redhat.com \
--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