summaryrefslogtreecommitdiff
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorAjay Nandakumar <anandakumarm@nvidia.com>2013-10-16 02:02:18 +0530
committerBharat Nihalani <bnihalani@nvidia.com>2013-10-16 06:52:28 -0700
commit8dce88049a77d821e1993d5eda79805aa4a6ddc6 (patch)
tree8fbdf792c3b82d3eb3b7fd4e37288456c4be80e4 /drivers/cpufreq
parent0b62d0b552eb29d6cebdca7b5339c78efc1ccb92 (diff)
cpufreq: Interactive: make cpufreq_interactive_tunables global
Making cpufreq_interactive_tunables global so that the tuning knobs values set from user space presist. This needs to be re-visited once per-cpu governor is enabled. Change-Id: I762510c8e588a73a4dfcaac95d2b6008e7fee0f4 Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com> Reviewed-on: http://git-master/r/299598 Reviewed-by: Puneet Saxena <puneets@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq_interactive.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c
index 68fbcb13132e..9ec65e4fe0d0 100644
--- a/drivers/cpufreq/cpufreq_interactive.c
+++ b/drivers/cpufreq/cpufreq_interactive.c
@@ -136,6 +136,8 @@ struct cpufreq_interactive_tunables {
/* For cases where we have single governor instance for system */
struct cpufreq_interactive_tunables *common_tunables;
+struct cpufreq_interactive_tunables global_tunables;
+
static struct attribute_group *get_sysfs_attr(void);
static void cpufreq_interactive_timer_resched(
@@ -1142,33 +1144,14 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
return 0;
}
- tunables = kzalloc(sizeof(*tunables), GFP_KERNEL);
- if (!tunables) {
- pr_err("%s: POLICY_INIT: kzalloc failed\n", __func__);
- return -ENOMEM;
- }
+ tunables = &global_tunables;
rc = sysfs_create_group(get_governor_parent_kobj(policy),
get_sysfs_attr());
- if (rc) {
- kfree(tunables);
+ if (rc)
return rc;
- }
tunables->usage_count = 1;
- tunables->above_hispeed_delay = default_above_hispeed_delay;
- tunables->nabove_hispeed_delay =
- ARRAY_SIZE(default_above_hispeed_delay);
- tunables->go_hispeed_load = DEFAULT_GO_HISPEED_LOAD;
- tunables->target_loads = default_target_loads;
- tunables->ntarget_loads = ARRAY_SIZE(default_target_loads);
- tunables->min_sample_time = DEFAULT_MIN_SAMPLE_TIME;
- tunables->timer_rate = DEFAULT_TIMER_RATE;
- tunables->boostpulse_duration_val = DEFAULT_MIN_SAMPLE_TIME;
- tunables->timer_slack_val = DEFAULT_TIMER_SLACK;
-
- spin_lock_init(&tunables->target_loads_lock);
- spin_lock_init(&tunables->above_hispeed_delay_lock);
if (!policy->governor->initialized) {
idle_notifier_register(&cpufreq_interactive_idle_nb);
@@ -1192,7 +1175,6 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
sysfs_remove_group(get_governor_parent_kobj(policy),
get_sysfs_attr());
- kfree(tunables);
common_tunables = NULL;
}
@@ -1297,6 +1279,7 @@ static int __init cpufreq_interactive_init(void)
unsigned int i;
struct cpufreq_interactive_cpuinfo *pcpu;
struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
+ struct cpufreq_interactive_tunables *tunables = &global_tunables;
/* Initalize per-cpu timers */
for_each_possible_cpu(i) {
@@ -1310,6 +1293,21 @@ static int __init cpufreq_interactive_init(void)
init_rwsem(&pcpu->enable_sem);
}
+ tunables->above_hispeed_delay = default_above_hispeed_delay;
+ tunables->nabove_hispeed_delay =
+ ARRAY_SIZE(default_above_hispeed_delay);
+ tunables->go_hispeed_load = DEFAULT_GO_HISPEED_LOAD;
+ tunables->target_loads = default_target_loads;
+ tunables->ntarget_loads = ARRAY_SIZE(default_target_loads);
+ tunables->min_sample_time = DEFAULT_MIN_SAMPLE_TIME;
+ tunables->timer_rate = DEFAULT_TIMER_RATE;
+ tunables->boostpulse_duration_val = DEFAULT_MIN_SAMPLE_TIME;
+ tunables->timer_slack_val = DEFAULT_TIMER_SLACK;
+
+ spin_lock_init(&tunables->target_loads_lock);
+ spin_lock_init(&tunables->above_hispeed_delay_lock);
+
+
spin_lock_init(&speedchange_cpumask_lock);
mutex_init(&gov_lock);
speedchange_task =