From: Viresh Kumar <viresh.kumar@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org,
Preeti U Murthy <preeti@linux.vnet.ibm.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V3 1/5] cpufreq: ondemand: Drop unnecessary locks from update_sampling_rate()
Date: Wed, 28 Oct 2015 10:14:51 +0530 [thread overview]
Message-ID: <20151028044451.GA30039@ubuntu> (raw)
In-Reply-To: <9152551.Va141R8GGE@vostro.rjw.lan>
On 28-10-15, 05:05, Rafael J. Wysocki wrote:
> On Tuesday, October 13, 2015 01:39:01 PM Viresh Kumar wrote:
> > 'timer_mutex' is required to sync work-handlers of policy->cpus.
> > update_sampling_rate() is just canceling the works and queuing them
> > again. This isn't protecting anything at all in update_sampling_rate()
> > and is not gonna be of any use.
> >
> > Even if a work-handler is already running for a CPU,
> > cancel_delayed_work_sync() will wait for it to finish.
> >
> > Drop these unnecessary locks.
> >
> > Reviewed-by: Preeti U Murthy <preeti@linux.vnet.ibm.com>
> > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>
> I'm queuing this up for 4.4, although I think that the changelog is not right.
>
> While at it, what are the race conditions the lock is protecting against?
In cases where a single policy controls multiple CPUs, a timer is
queued for every cpu present in policy->cpus. When we reach the timer
handler (which can be on multiple CPUs together) on any CPU, we trace
CPU load for all policy->cpus and update the frequency accordingly.
The lock is for protecting multiple CPUs to do the same thing
together, as only its required to be done by a single CPU. Once any
CPUs handler has completed, it updates the last update time and drops
the mutex. At that point of time, other blocked handler (if any) check
the last update time and return early.
And then there are enough minute things that can go wrong if multiple
CPUs do the load evaluation and freq-update at the same time, apart
from it being an time wasting effort.
And so I still think that the commit log isn't that bad. The
timer_mutex lock isn't required in other parts of the governor, they
are just for synchronizing the work-handlers of CPUs belonging to the
same policy.
--
viresh
next prev parent reply other threads:[~2015-10-28 4:44 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 8:09 [PATCH V3 0/5] CPUFreq: governors: further cleanups Viresh Kumar
2015-10-13 8:09 ` [PATCH V3 1/5] cpufreq: ondemand: Drop unnecessary locks from update_sampling_rate() Viresh Kumar
2015-10-28 4:05 ` Rafael J. Wysocki
2015-10-28 4:44 ` Viresh Kumar [this message]
2015-10-28 5:54 ` Rafael J. Wysocki
2015-10-28 6:43 ` Viresh Kumar
2015-10-28 7:46 ` Rafael J. Wysocki
2015-10-28 8:56 ` Viresh Kumar
2015-10-13 8:09 ` [PATCH V3 2/5] cpufreq: ondemand: update sampling rate immediately Viresh Kumar
2015-10-28 6:28 ` Rafael J. Wysocki
2015-10-28 9:31 ` Viresh Kumar
2015-10-28 15:31 ` Rafael J. Wysocki
2015-10-28 15:28 ` Viresh Kumar
2015-10-28 16:13 ` Rafael J. Wysocki
2015-10-28 15:47 ` Viresh Kumar
2015-10-13 8:09 ` [PATCH V3 3/5] cpufreq: ondemand: queue work for policy->cpus together Viresh Kumar
2015-10-28 6:38 ` Rafael J. Wysocki
2015-10-28 6:46 ` Viresh Kumar
2015-10-28 7:33 ` Rafael J. Wysocki
2015-10-28 8:34 ` Viresh Kumar
2015-10-13 8:09 ` [PATCH V3 4/5] cpufreq: governor: Quit work-handlers early if governor is stopped Viresh Kumar
2015-10-28 7:10 ` Rafael J. Wysocki
2015-10-28 8:25 ` Viresh Kumar
2015-10-28 15:12 ` Rafael J. Wysocki
2015-10-28 14:46 ` Viresh Kumar
2015-10-13 8:09 ` [PATCH V3 5/5] cpufreq: Get rid of ->governor_enabled and its lock 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=20151028044451.GA30039@ubuntu \
--to=viresh.kumar@linaro.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=preeti@linux.vnet.ibm.com \
--cc=rjw@rjwysocki.net \
/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).