[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4787292.dQnn9ZTm9B@vostro.rjw.lan>
Date: Fri, 05 Feb 2016 23:59:11 +0100
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Viresh Kumar <viresh.kumar@...aro.org>
Cc: Linux PM list <linux-pm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
Juri Lelli <juri.lelli@....com>,
Steve Muckle <steve.muckle@...aro.org>,
Saravana Kannan <skannan@...eaurora.org>
Subject: Re: [PATCH v2 2/10] cpufreq: governor: Use common mutex for dbs_data protection
On Friday, February 05, 2016 12:23:41 PM Viresh Kumar wrote:
> On 05-02-16, 03:14, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> >
> > Every governor relying on the common code in cpufreq_governor.c
> > has to provide its own mutex in struct common_dbs_data. However,
> > there actually is no need to have a separate mutex per governor
> > for this purpose, they may be using the same global mutex just
> > fine. Accordingly, introduce a single common mutex for that and
> > drop the mutex field from struct common_dbs_data.
> >
> > That at least will ensure that the mutex is always present and
> > initialized regardless of what the particular governors do.
> >
> > Another benefit is that the common code does not need a pointer to
> > a governor-related structure to get to the mutex which sometimes
> > helps.
> >
> > Finally, it makes the code generally easier to follow.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
> > Acked-by: Saravana Kannan <skannan@...eaurora.org>
>
> Acked-by: Viresh Kumar <viresh.kumar@...aro.org>
Thanks!
One more observation here.
If we are able to eliminate dbs_data_mutex from update_sampling_rate(),
then cpufreq_governor_dbs() becomes the only user of that lock. Further,
if we can guarantee that the governor's ->governor callback will always
be invoked under policy->rwsem, dbs_data_mutex becomes unnecessary and
may be dropped.
Thanks,
Rafael
Powered by blists - more mailing lists