From: Viresh Kumar <viresh.kumar@linaro.org>
To: Matthias Kaehlcke <mka@chromium.org>
Cc: Rafael Wysocki <rjw@rjwysocki.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <vireshk@kernel.org>,
linux-pm@vger.kernel.org,
Vincent Guittot <vincent.guittot@linaro.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] drivers: base: Add frequency constraint infrastructure
Date: Fri, 18 Jan 2019 15:32:34 +0530 [thread overview]
Message-ID: <20190118100234.kq37hc4ldujqvvrb@vireshk-i7> (raw)
In-Reply-To: <20190118010305.GX261387@google.com>
On 17-01-19, 17:03, Matthias Kaehlcke wrote:
> On Fri, Jan 11, 2019 at 02:48:34PM +0530, Viresh Kumar wrote:
> > +static void fcs_update(struct freq_constraints *fcs, struct freq_pair *freq,
> > + enum fc_event event)
> > +{
> > + mutex_lock(&fcs->lock);
> > +
> > + if (_fcs_update(fcs, freq, event)) {
> > + if (fcs->callback)
> > + schedule_work(&fcs->work);
>
> IIUC the constraints aren't applied until the callback is executed. I
> wonder if a dedicated workqueue should be used instead of the system
> one, to avoid longer delays from other kernel entities that might
> 'misbehave'. Especially for thermal constraints we want a quick
> response.
I thought the system workqueue should be fast enough, it contains
multiple threads which can all run in parallel and service this work.
> > +
> > + /* Find a CPU for which fcs already exists */
> > + for_each_cpu(cpu, cpumask) {
> > + cpu_dev = get_cpu_device(cpu);
> > + if (unlikely(!cpu_dev))
> > + continue;
> > +
> > + if (unlikely(!first_cpu_dev))
> > + first_cpu_dev = cpu_dev;
>
> I'd expect setting the callback to be a one time/rare operation. Is
> there really any gain from cluttering this code with 'unlikely's?
>
> There are other functions where it could be removed if the outcome is
> that it isn't needed/desirable in code that only runs sporadically.
I was looking to make the code as fast as possible and the use of
unlikely doesn't look that bad to me. Lets see what others have to say
on such a policy.
> > + if (ret)
> > + remove_cpumask_fcs(fcs, cpumask, cpu);
>
> I think it would be clearer to pass -1 instead of 'cpu', as in
> freq_constraint_remove_cpumask_callback(), no need to backtrack and
> 'confirm' that the above for loop always stops at the last CPU in the
> cpumask (unless the function returns due to an error).
Okay.
--
viresh
next prev parent reply other threads:[~2019-01-18 10:02 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-11 9:18 [PATCH 0/3] drivers: Frequency constraint infrastructure Viresh Kumar
2019-01-11 9:18 ` [PATCH 1/3] drivers: base: Add frequency " Viresh Kumar
2019-01-18 1:03 ` Matthias Kaehlcke
2019-01-18 10:02 ` Viresh Kumar [this message]
2019-01-18 22:45 ` Matthias Kaehlcke
2019-01-22 7:09 ` Viresh Kumar
2019-01-22 17:50 ` Matthias Kaehlcke
2019-01-11 9:18 ` [PATCH 2/3] cpufreq: Implement freq-constraint callback Viresh Kumar
2019-01-18 1:46 ` Matthias Kaehlcke
2019-01-18 1:49 ` Matthias Kaehlcke
2019-01-11 9:18 ` [PATCH 3/3] cpufreq: Implement USER constraint Viresh Kumar
2019-01-11 9:47 ` [PATCH 0/3] drivers: Frequency constraint infrastructure Rafael J. Wysocki
2019-01-17 13:16 ` Juri Lelli
2019-01-17 14:55 ` Rafael J. Wysocki
2019-01-18 12:39 ` Juri Lelli
2019-01-21 11:10 ` Rafael J. Wysocki
2019-01-22 19:30 ` Matthias Kaehlcke
[not found] ` <CA+mqd+7EqERei8eekAsVxa_bJUYETyO3T76L8Q_sV=C9rwiy3g@mail.gmail.com>
2019-01-28 14:04 ` Qais Yousef
2019-01-30 5:27 ` Viresh Kumar
2019-01-30 5:25 ` Viresh Kumar
2019-02-08 9:08 ` Viresh Kumar
2019-02-08 9:09 ` Viresh Kumar
2019-02-08 9:53 ` Rafael J. Wysocki
2019-02-08 10:23 ` Viresh Kumar
2019-02-08 10:35 ` Rafael J. Wysocki
2019-02-11 5:43 ` 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=20190118100234.kq37hc4ldujqvvrb@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mka@chromium.org \
--cc=rafael@kernel.org \
--cc=rjw@rjwysocki.net \
--cc=vincent.guittot@linaro.org \
--cc=vireshk@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;
as well as URLs for NNTP newsgroup(s).