From: Viresh Kumar <viresh.kumar@linaro.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: "Rafael Wysocki" <rjw@rjwysocki.net>,
"Borislav Petkov" <bp@alien8.de>,
"David S. Miller" <davem@davemloft.net>,
"H. Peter Anvin" <hpa@zytor.com>,
"Ingo Molnar" <mingo@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
"Russell King" <linux@armlinux.org.uk>,
"Thomas Gleixner" <tglx@linutronix.de>,
"the arch/x86 maintainers" <x86@kernel.org>,
"Linux PM" <linux-pm@vger.kernel.org>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
kvm@vger.kernel.org,
"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
sparclinux@vger.kernel.org
Subject: Re: [PATCH 0/7] cpufreq: Call transition notifier only once for each policy
Date: Thu, 14 Mar 2019 15:46:06 +0530 [thread overview]
Message-ID: <20190314101606.2aodwz5mzvstau6c@vireshk-i7> (raw)
In-Reply-To: <CAJZ5v0gER+aJaQmk89VSVBtHgQ+WPDdAxUW6eJ4JCB=emC85dg@mail.gmail.com>
On 14-03-19, 10:28, Rafael J. Wysocki wrote:
> On Thu, Mar 14, 2019 at 7:43 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >
> > Currently we call the cpufreq transition notifiers once for each CPU of
> > the policy->cpus cpumask, which isn't that efficient.
>
> Why isn't it efficient?
>
> Transitions are per-policy anyway, so if something needs to be done
> for each CPU in the policy, it doesn't matter too much which part of
> the code carries out the iteration.
Even if per-cpu iteration has to be done at some place, we are
avoiding function calls here and the code/locking in the notifier
layer as well. Will get more such info into changelog.
> I guess some notifiers need to know what other CPUs there are in the
> policy? If so, then why?
You mean about the offline CPUs? I mentioned the rationale in 1/7. It
is to avoid bugs where we may end up using a stale value if the CPUs
are offlined/onlined regularly.
> > This patchset tries to simplify that by adding another field in struct cpufreq_freqs,
> > cpus, so the callback has all the information available with a single
> > call for each policy.
>
> Well, you can argue that the core is simplified by it somewhat, but
> the notifiers aren't. They actually get more complex, conceptually
> too, because they now need to worry about offline vs online CPUs etc.
24 different parts of the kernel register for transition notifiers and
only 5 required update here, the other 19 don't need to do per-cpu
stuff and they also get benefited by this work. Those routines will
get called only once now, instead of once per every CPU of the policy.
> Also I wonder why you decided to pass a cpumask in freqs instead of
> just passing a policy pointer. If you change things from per-CPU to
> per-policy, passing the whole policy seems more natural.
I did that because they don't need to use the other fields of the
policy today and that doesn't look likely in near future as well.
I can do that if you want, but not sure why more information should be
provided than required.
--
viresh
next prev parent reply other threads:[~2019-03-14 10:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-14 6:42 Viresh Kumar
2019-03-14 6:42 ` [PATCH 1/7] cpufreq: Pass policy->related_cpus to transition notifiers Viresh Kumar
2019-03-14 6:42 ` [PATCH 2/7] ARM: smp: Update cpufreq transition notifier to handle multiple CPUs Viresh Kumar
2019-03-14 6:42 ` [PATCH 3/7] ARM: twd: " Viresh Kumar
2019-03-14 6:42 ` [PATCH 4/7] sparc64: " Viresh Kumar
2019-03-14 17:27 ` David Miller
2019-03-14 6:42 ` [PATCH 5/7] x86/tsc: " Viresh Kumar
2019-03-14 9:33 ` Rafael J. Wysocki
2019-03-14 10:03 ` Viresh Kumar
2019-03-14 6:42 ` [PATCH 6/7] KVM: x86: " Viresh Kumar
2019-03-14 6:42 ` [PATCH 7/7] cpufreq: Call transition notifiers only once for each policy Viresh Kumar
2019-03-14 9:28 ` [PATCH 0/7] cpufreq: Call transition notifier " Rafael J. Wysocki
2019-03-14 9:40 ` Rafael J. Wysocki
2019-03-14 10:18 ` Viresh Kumar
2019-03-14 10:16 ` Viresh Kumar [this message]
2019-03-14 10:55 ` Rafael J. Wysocki
2019-03-14 11:03 ` Viresh Kumar
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=20190314101606.2aodwz5mzvstau6c@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=bp@alien8.de \
--cc=davem@davemloft.net \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=rkrcmar@redhat.com \
--cc=sparclinux@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=vincent.guittot@linaro.org \
--cc=x86@kernel.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
all inboxes | Powered by JetHome®