From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
cpufreq@vger.kernel.org,
"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
LKML <linux-kernel@vger.kernel.org>,
Lists linaro-kernel <linaro-kernel@lists.linaro.org>
Subject: Re: [Update][PATCH] cpufreq: Do not hold driver module references for additional policy CPUs
Date: Fri, 02 Aug 2013 15:31:35 +0200 [thread overview]
Message-ID: <5361062.ChI1FUI32W@vostro.rjw.lan> (raw)
In-Reply-To: <CAKohpon7jyJWhf+j-M6Nuqy-AaY73YUpBpt-1uh12e_SYRv2bQ@mail.gmail.com>
On Friday, August 02, 2013 04:25:58 PM Viresh Kumar wrote:
> On 2 August 2013 10:07, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >> @@ -908,7 +905,8 @@ static int cpufreq_add_policy_cpu(unsign
> >> unsigned long flags;
> >>
> >> policy = cpufreq_cpu_get(sibling);
> >
> > This can be skipped completely at this place. Caller of
> > cpufreq_add_policy_cpu() has got the policy pointer with it and so
> > can be passed. I haven't done it earlier as the impression was we need
> > to call cpufreq_cpu_get()..
>
> And here is the fixup to do this (attached too):
Care to add a changelog?
I'll apply this on top of my $subject patch, then.
Thanks,
Rafael
> ---
> drivers/cpufreq/cpufreq.c | 18 ++++++------------
> 1 file changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 46e70ae..47f2a6e 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -889,21 +889,17 @@ static void cpufreq_init_policy(struct
> cpufreq_policy *policy)
> }
>
> #ifdef CONFIG_HOTPLUG_CPU
> -static int cpufreq_add_policy_cpu(unsigned int cpu, unsigned int sibling,
> - struct device *dev, bool frozen)
> +static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy,
> + unsigned int cpu, struct device *dev,
> + bool frozen)
> {
> - struct cpufreq_policy *policy;
> int ret = 0, has_target = !!cpufreq_driver->target;
> unsigned long flags;
>
> - policy = cpufreq_cpu_get(sibling);
> - if (WARN_ON_ONCE(!policy))
> - return -ENODATA;
> -
> if (has_target)
> __cpufreq_governor(policy, CPUFREQ_GOV_STOP);
>
> - lock_policy_rwsem_write(sibling);
> + lock_policy_rwsem_write(policy->cpu);
>
> write_lock_irqsave(&cpufreq_driver_lock, flags);
>
> @@ -912,7 +908,7 @@ static int cpufreq_add_policy_cpu(unsigned int
> cpu, unsigned int sibling,
> per_cpu(cpufreq_cpu_data, cpu) = policy;
> write_unlock_irqrestore(&cpufreq_driver_lock, flags);
>
> - unlock_policy_rwsem_write(sibling);
> + unlock_policy_rwsem_write(policy->cpu);
>
> if (has_target) {
> __cpufreq_governor(policy, CPUFREQ_GOV_START);
> @@ -923,7 +919,6 @@ static int cpufreq_add_policy_cpu(unsigned int
> cpu, unsigned int sibling,
> if (!frozen)
> ret = sysfs_create_link(&dev->kobj, &policy->kobj, "cpufreq");
>
> - cpufreq_cpu_put(policy);
> return ret;
> }
> #endif
> @@ -1006,8 +1001,7 @@ static int __cpufreq_add_dev(struct device *dev,
> struct subsys_interface *sif,
> struct cpufreq_policy *cp = per_cpu(cpufreq_cpu_data, sibling);
> if (cp && cpumask_test_cpu(cpu, cp->related_cpus)) {
> read_unlock_irqrestore(&cpufreq_driver_lock, flags);
> - return cpufreq_add_policy_cpu(cpu, sibling, dev,
> - frozen);
> + return cpufreq_add_policy_cpu(cp, cpu, dev, frozen);
> }
> }
> read_unlock_irqrestore(&cpufreq_driver_lock, flags);
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
next prev parent reply other threads:[~2013-08-02 13:31 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-01 0:08 [RFC][PATCH] cpufreq: Do not hold driver module references for additional policy CPUs Rafael J. Wysocki
2013-08-01 8:11 ` Srivatsa S. Bhat
2013-08-01 14:44 ` Viresh Kumar
2013-08-01 15:24 ` Srivatsa S. Bhat
2013-08-01 17:24 ` Viresh Kumar
2013-08-01 18:09 ` Rafael J. Wysocki
2013-08-01 18:04 ` Rafael J. Wysocki
2013-08-01 18:06 ` Srivatsa S. Bhat
2013-08-01 19:01 ` Rafael J. Wysocki
2013-08-01 19:01 ` Srivatsa S. Bhat
2013-08-01 19:21 ` Rafael J. Wysocki
2013-08-01 19:21 ` Srivatsa S. Bhat
2013-08-01 20:04 ` Rafael J. Wysocki
2013-08-01 20:26 ` Srivatsa S. Bhat
2013-08-01 20:47 ` Rafael J. Wysocki
2013-08-01 20:53 ` [Update][PATCH] " Rafael J. Wysocki
2013-08-02 4:37 ` Viresh Kumar
2013-08-02 6:49 ` Srivatsa S. Bhat
2013-08-02 6:59 ` Viresh Kumar
2013-08-02 7:09 ` Srivatsa S. Bhat
2013-08-02 7:16 ` Viresh Kumar
2013-08-02 9:36 ` Viresh Kumar
2013-08-02 10:12 ` Srivatsa S. Bhat
2013-08-02 10:55 ` Viresh Kumar
2013-08-02 13:31 ` Rafael J. Wysocki [this message]
2013-08-02 14:38 ` Viresh Kumar
2013-08-02 14:46 ` Srivatsa S. Bhat
2013-08-02 10:30 ` Viresh Kumar
2013-08-02 11:35 ` Srivatsa S. Bhat
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=5361062.ChI1FUI32W@vostro.rjw.lan \
--to=rjw@sisk.pl \
--cc=cpufreq@vger.kernel.org \
--cc=linaro-kernel@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=srivatsa.bhat@linux.vnet.ibm.com \
--cc=viresh.kumar@linaro.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