From: skannan@codeaurora.org (Saravana Kannan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 5/5] cpufreq: Delete dead code related to policy save/restore
Date: Thu, 24 Jul 2014 18:07:28 -0700 [thread overview]
Message-ID: <1406250448-470-6-git-send-email-skannan@codeaurora.org> (raw)
In-Reply-To: <1406250448-470-1-git-send-email-skannan@codeaurora.org>
Since we no longer destroy/realloc policy during logical hotplug, most of
the policy save/restore code is dead code that doesn't get executed. Remove
those.
Signed-off-by: Saravana Kannan <skannan@codeaurora.org>
---
drivers/cpufreq/cpufreq.c | 82 +++++++++--------------------------------------
1 file changed, 15 insertions(+), 67 deletions(-)
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 97edf05..b635e0e 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -37,7 +37,6 @@
*/
static struct cpufreq_driver *cpufreq_driver;
static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);
-static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data_fallback);
static DEFINE_RWLOCK(cpufreq_driver_lock);
DEFINE_MUTEX(cpufreq_governor_lock);
static LIST_HEAD(cpufreq_policy_list);
@@ -1006,22 +1005,6 @@ static int cpufreq_add_policy_cpu(struct cpufreq_policy *policy,
}
#endif
-static struct cpufreq_policy *cpufreq_policy_restore(unsigned int cpu)
-{
- struct cpufreq_policy *policy;
- unsigned long flags;
-
- read_lock_irqsave(&cpufreq_driver_lock, flags);
-
- policy = per_cpu(cpufreq_cpu_data_fallback, cpu);
-
- read_unlock_irqrestore(&cpufreq_driver_lock, flags);
-
- policy->governor = NULL;
-
- return policy;
-}
-
static struct cpufreq_policy *cpufreq_policy_alloc(void)
{
struct cpufreq_policy *policy;
@@ -1104,7 +1087,6 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
int ret = -ENOMEM;
struct cpufreq_policy *policy;
unsigned long flags;
- bool recover_policy = cpufreq_suspended;
pr_debug("adding CPU %u\n", cpu);
@@ -1142,31 +1124,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
/* If we get this far, this is the first time we are adding the
* policy */
- recover_policy = false;
-
- /*
- * Restore the saved policy when doing light-weight init and fall back
- * to the full init if that fails.
- */
- policy = recover_policy ? cpufreq_policy_restore(cpu) : NULL;
- if (!policy) {
- recover_policy = false;
- policy = cpufreq_policy_alloc();
- if (!policy)
- goto nomem_out;
- }
-
- /*
- * In the resume path, since we restore a saved policy, the assignment
- * to policy->cpu is like an update of the existing policy, rather than
- * the creation of a brand new one. So we need to perform this update
- * by invoking update_policy_cpu().
- */
- if (recover_policy && cpu != policy->cpu)
- update_policy_cpu(policy, cpu);
- else
- policy->cpu = cpu;
+ policy = cpufreq_policy_alloc();
+ if (!policy)
+ goto nomem_out;
+ policy->cpu = cpu;
cpumask_copy(policy->cpus, cpumask_of(cpu));
init_completion(&policy->kobj_unregister);
@@ -1190,10 +1152,8 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
*/
cpumask_and(policy->cpus, policy->cpus, cpu_online_mask);
- if (!recover_policy) {
- policy->user_policy.min = policy->min;
- policy->user_policy.max = policy->max;
- }
+ policy->user_policy.min = policy->min;
+ policy->user_policy.max = policy->max;
down_write(&policy->rwsem);
write_lock_irqsave(&cpufreq_driver_lock, flags);
@@ -1252,13 +1212,11 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
CPUFREQ_START, policy);
- if (!recover_policy) {
- ret = cpufreq_add_dev_interface(policy, dev);
- if (ret)
- goto err_out_unregister;
- blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
- CPUFREQ_CREATE_POLICY, policy);
- }
+ ret = cpufreq_add_dev_interface(policy, dev);
+ if (ret)
+ goto err_out_unregister;
+ blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
+ CPUFREQ_CREATE_POLICY, policy);
write_lock_irqsave(&cpufreq_driver_lock, flags);
list_add(&policy->policy_list, &cpufreq_policy_list);
@@ -1266,10 +1224,8 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif)
cpufreq_init_policy(policy);
- if (!recover_policy) {
- policy->user_policy.policy = policy->policy;
- policy->user_policy.governor = policy->governor;
- }
+ policy->user_policy.policy = policy->policy;
+ policy->user_policy.governor = policy->governor;
up_write(&policy->rwsem);
kobject_uevent(&policy->kobj, KOBJ_ADD);
@@ -1289,13 +1245,7 @@ err_get_freq:
if (cpufreq_driver->exit)
cpufreq_driver->exit(policy);
err_set_policy_cpu:
- if (recover_policy) {
- /* Do not leave stale fallback data behind. */
- per_cpu(cpufreq_cpu_data_fallback, cpu) = NULL;
- cpufreq_policy_put_kobj(policy);
- }
cpufreq_policy_free(policy);
-
nomem_out:
up_read(&cpufreq_rwsem);
@@ -1442,8 +1392,7 @@ static int __cpufreq_remove_dev_finish(struct device *dev,
}
}
- if (!cpufreq_suspended)
- cpufreq_policy_put_kobj(policy);
+ cpufreq_policy_put_kobj(policy);
/*
* Perform the ->exit() even during light-weight tear-down,
@@ -1458,8 +1407,7 @@ static int __cpufreq_remove_dev_finish(struct device *dev,
list_del(&policy->policy_list);
write_unlock_irqrestore(&cpufreq_driver_lock, flags);
- if (!cpufreq_suspended)
- cpufreq_policy_free(policy);
+ cpufreq_policy_free(policy);
}
per_cpu(cpufreq_cpu_data, cpu) = NULL;
--
1.8.2.1
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
next prev parent reply other threads:[~2014-07-25 1:07 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-10 2:37 [PATCH] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend Saravana Kannan
2014-07-11 4:18 ` [PATCH v2] " Saravana Kannan
2014-07-11 6:19 ` Viresh Kumar
2014-07-11 9:59 ` skannan at codeaurora.org
2014-07-11 10:07 ` skannan at codeaurora.org
2014-07-11 10:52 ` Viresh Kumar
2014-07-12 2:44 ` Saravana Kannan
2014-07-14 6:09 ` Viresh Kumar
2014-07-14 19:08 ` Saravana Kannan
2014-07-15 4:35 ` Viresh Kumar
2014-07-15 5:36 ` Saravana Kannan
2014-07-15 5:52 ` Viresh Kumar
2014-07-15 6:58 ` Srivatsa S. Bhat
2014-07-15 17:35 ` skannan at codeaurora.org
2014-07-16 7:44 ` Srivatsa S. Bhat
2014-07-16 5:44 ` Viresh Kumar
2014-07-16 7:49 ` Srivatsa S. Bhat
2014-07-12 3:06 ` Saravana Kannan
2014-07-14 6:13 ` Viresh Kumar
2014-07-14 19:10 ` Saravana Kannan
2014-07-11 7:43 ` Srivatsa S. Bhat
2014-07-11 10:02 ` skannan at codeaurora.org
2014-07-15 22:47 ` [PATCH v3 0/2] Simplify hotplug/suspend handling Saravana Kannan
2014-07-15 22:47 ` [PATCH v3 1/2] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend Saravana Kannan
2014-07-16 0:28 ` Saravana Kannan
2014-07-16 8:30 ` Viresh Kumar
2014-07-16 19:19 ` Saravana Kannan
2014-07-16 8:24 ` Viresh Kumar
2014-07-16 11:16 ` Srivatsa S. Bhat
2014-07-16 13:13 ` Viresh Kumar
2014-07-16 18:04 ` Srivatsa S. Bhat
2014-07-16 19:56 ` Saravana Kannan
2014-07-17 5:51 ` Viresh Kumar
2014-07-16 19:56 ` Saravana Kannan
2014-07-17 5:35 ` Viresh Kumar
2014-07-18 3:25 ` Saravana Kannan
2014-07-18 4:19 ` Viresh Kumar
2014-07-16 20:25 ` Saravana Kannan
2014-07-16 21:45 ` Saravana Kannan
2014-07-17 6:24 ` Viresh Kumar
2014-07-16 14:29 ` Dirk Brandewie
2014-07-16 15:28 ` Viresh Kumar
2014-07-16 19:42 ` Saravana Kannan
2014-07-15 22:47 ` [PATCH v3 2/2] cpufreq: Simplify and fix mutual exclusion with hotplug Saravana Kannan
2014-07-16 8:48 ` Viresh Kumar
2014-07-16 19:34 ` Saravana Kannan
2014-07-25 1:07 ` [PATCH v4 0/5] Simplify hotplug/suspend handling Saravana Kannan
2014-07-25 1:07 ` [PATCH v4 1/5] cpufreq: Don't wait for CPU to going offline to restart governor Saravana Kannan
2014-07-31 20:47 ` Saravana Kannan
2014-07-25 1:07 ` [PATCH v4 2/5] cpufreq: Keep track of which CPU owns the kobj/sysfs nodes separately Saravana Kannan
2014-08-07 9:02 ` Viresh Kumar
2014-07-25 1:07 ` [PATCH v4 3/5] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend Saravana Kannan
2014-07-31 21:56 ` Rafael J. Wysocki
2014-07-31 22:15 ` Saravana Kannan
2014-07-31 23:48 ` Saravana Kannan
2014-08-07 10:51 ` Viresh Kumar
2014-08-12 9:17 ` Viresh Kumar
2014-08-07 10:48 ` Viresh Kumar
2014-08-11 22:13 ` Saravana Kannan
2014-08-12 8:51 ` Viresh Kumar
2014-07-25 1:07 ` [PATCH v4 4/5] cpufreq: Properly handle physical CPU hot-add/hot-remove Saravana Kannan
2014-08-07 11:02 ` Viresh Kumar
2014-08-11 22:15 ` Saravana Kannan
2014-07-25 1:07 ` Saravana Kannan [this message]
2014-08-07 11:06 ` [PATCH v4 5/5] cpufreq: Delete dead code related to policy save/restore Viresh Kumar
2014-07-29 5:52 ` [PATCH v4 0/5] Simplify hotplug/suspend handling skannan at codeaurora.org
2014-07-30 0:29 ` Rafael J. Wysocki
2014-07-31 20:25 ` Saravana Kannan
2014-08-07 6:04 ` skannan at codeaurora.org
2014-10-16 8:53 ` Viresh Kumar
2014-10-23 21:41 ` Saravana Kannan
2014-07-16 22:02 ` [PATCH] cpufreq: Don't destroy/realloc policy/sysfs on hotplug/suspend Rafael J. Wysocki
2014-07-16 22:35 ` Saravana Kannan
2014-07-24 3:02 ` Saravana Kannan
2014-07-24 5:04 ` Viresh Kumar
2014-07-24 9:12 ` skannan at codeaurora.org
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=1406250448-470-6-git-send-email-skannan@codeaurora.org \
--to=skannan@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.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).