diff mbox

cpufreq: governors: fix misuse of cdbs.cpu

Message ID 1359628759-15006-1-git-send-email-fabio.baltieri@linaro.org (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Fabio Baltieri Jan. 31, 2013, 10:39 a.m. UTC
Fix governors code to set all cpu's cdbs->cpu to the the actual cpu id
and use cur_policy->cpu istead of cdbs->cpu to track current governor's
leader cpu.

Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
---
 drivers/cpufreq/cpufreq_conservative.c | 5 +++--
 drivers/cpufreq/cpufreq_governor.c     | 2 +-
 drivers/cpufreq/cpufreq_ondemand.c     | 5 +++--
 3 files changed, 7 insertions(+), 5 deletions(-)

Comments

Viresh Kumar Jan. 31, 2013, 10:47 a.m. UTC | #1
On 31 January 2013 16:09, Fabio Baltieri <fabio.baltieri@linaro.org> wrote:
> Fix governors code to set all cpu's cdbs->cpu to the the actual cpu id
> and use cur_policy->cpu istead of cdbs->cpu to track current governor's
> leader cpu.
>
> Reported-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Fabio Baltieri <fabio.baltieri@linaro.org>
> ---
>  drivers/cpufreq/cpufreq_conservative.c | 5 +++--
>  drivers/cpufreq/cpufreq_governor.c     | 2 +-
>  drivers/cpufreq/cpufreq_ondemand.c     | 5 +++--
>  3 files changed, 7 insertions(+), 5 deletions(-)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index 653fb06..c18a304 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -114,7 +114,7 @@  static void cs_check_cpu(int cpu, unsigned int load)
 static void cs_timer_update(struct cs_cpu_dbs_info_s *dbs_info, bool sample,
 			    struct delayed_work *dw)
 {
-	unsigned int cpu = dbs_info->cdbs.cpu;
+	unsigned int cpu = dbs_info->cdbs.cur_policy->cpu;
 	int delay = delay_for_sampling_rate(cs_tuners.sampling_rate);
 
 	if (sample)
@@ -132,7 +132,8 @@  static void cs_timer_coordinated(struct cs_cpu_dbs_info_s *dbs_info_local,
 	bool sample = true;
 
 	/* use leader CPU's dbs_info */
-	dbs_info = &per_cpu(cs_cpu_dbs_info, dbs_info_local->cdbs.cpu);
+	dbs_info = &per_cpu(cs_cpu_dbs_info,
+			    dbs_info_local->cdbs.cur_policy->cpu);
 	mutex_lock(&dbs_info->cdbs.timer_mutex);
 
 	time_now = ktime_get();
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index 67e235a..46f1c78 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -208,11 +208,11 @@  int cpufreq_governor_dbs(struct dbs_data *dbs_data,
 		mutex_lock(&dbs_data->mutex);
 
 		dbs_data->enable++;
-		cpu_cdbs->cpu = cpu;
 		for_each_cpu(j, policy->cpus) {
 			struct cpu_dbs_common_info *j_cdbs;
 			j_cdbs = dbs_data->get_cpu_cdbs(j);
 
+			j_cdbs->cpu = j;
 			j_cdbs->cur_policy = policy;
 			j_cdbs->prev_cpu_idle = get_cpu_idle_time(j,
 					&j_cdbs->prev_cpu_wall);
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 5ae84ff..75efd5e 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -219,7 +219,7 @@  static void od_check_cpu(int cpu, unsigned int load_freq)
 static void od_timer_update(struct od_cpu_dbs_info_s *dbs_info, bool sample,
 			    struct delayed_work *dw)
 {
-	unsigned int cpu = dbs_info->cdbs.cpu;
+	unsigned int cpu = dbs_info->cdbs.cur_policy->cpu;
 	int delay, sample_type = dbs_info->sample_type;
 
 	/* Common NORMAL_SAMPLE setup */
@@ -255,7 +255,8 @@  static void od_timer_coordinated(struct od_cpu_dbs_info_s *dbs_info_local,
 	bool sample = true;
 
 	/* use leader CPU's dbs_info */
-	dbs_info = &per_cpu(od_cpu_dbs_info, dbs_info_local->cdbs.cpu);
+	dbs_info = &per_cpu(od_cpu_dbs_info,
+			    dbs_info_local->cdbs.cur_policy->cpu);
 	mutex_lock(&dbs_info->cdbs.timer_mutex);
 
 	time_now = ktime_get();