aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-02-27 00:36:36 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-03-31 19:11:34 -0400
commit9d44592018e617abf62a5f6a5d92a04aa07e7625 (patch)
tree224097c0f4d8407e149e813587a0266b32acdad9
parent98104ee28f451024170a9dfb7bec31bfcb7e7c14 (diff)
cpufreq: ondemand: Don't update sample_type if we don't evaluate load again
Because we have per cpu timer now, we check if we need to evaluate load again or not (In case it is recently evaluated). Here the 2nd cpu which got timer interrupt updates core_dbs_info->sample_type irrespective of load evaluation is required or not. Which is wrong as the first cpu is dependent on this variable set to an older value. Moreover it would be best in this case to schedule 2nd cpu's timer to sampling_rate instead of freq_lo or hi as that must be managed by the other cpu. In case the other cpu idles in between then also we wouldn't loose much power. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 15e80ee61352..c90d345c636a 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -224,34 +224,32 @@ static void od_dbs_timer(struct work_struct *work)
224 cpu); 224 cpu);
225 struct dbs_data *dbs_data = dbs_info->cdbs.cur_policy->governor_data; 225 struct dbs_data *dbs_data = dbs_info->cdbs.cur_policy->governor_data;
226 struct od_dbs_tuners *od_tuners = dbs_data->tuners; 226 struct od_dbs_tuners *od_tuners = dbs_data->tuners;
227 int delay, sample_type = core_dbs_info->sample_type; 227 int delay = 0, sample_type = core_dbs_info->sample_type;
228 bool eval_load;
229 228
230 mutex_lock(&core_dbs_info->cdbs.timer_mutex); 229 mutex_lock(&core_dbs_info->cdbs.timer_mutex);
231 eval_load = need_load_eval(&core_dbs_info->cdbs, 230 if (!need_load_eval(&core_dbs_info->cdbs, od_tuners->sampling_rate))
232 od_tuners->sampling_rate); 231 goto max_delay;
233 232
234 /* Common NORMAL_SAMPLE setup */ 233 /* Common NORMAL_SAMPLE setup */
235 core_dbs_info->sample_type = OD_NORMAL_SAMPLE; 234 core_dbs_info->sample_type = OD_NORMAL_SAMPLE;
236 if (sample_type == OD_SUB_SAMPLE) { 235 if (sample_type == OD_SUB_SAMPLE) {
237 delay = core_dbs_info->freq_lo_jiffies; 236 delay = core_dbs_info->freq_lo_jiffies;
238 if (eval_load) 237 __cpufreq_driver_target(core_dbs_info->cdbs.cur_policy,
239 __cpufreq_driver_target(core_dbs_info->cdbs.cur_policy, 238 core_dbs_info->freq_lo, CPUFREQ_RELATION_H);
240 core_dbs_info->freq_lo,
241 CPUFREQ_RELATION_H);
242 } else { 239 } else {
243 if (eval_load) 240 dbs_check_cpu(dbs_data, cpu);
244 dbs_check_cpu(dbs_data, cpu);
245 if (core_dbs_info->freq_lo) { 241 if (core_dbs_info->freq_lo) {
246 /* Setup timer for SUB_SAMPLE */ 242 /* Setup timer for SUB_SAMPLE */
247 core_dbs_info->sample_type = OD_SUB_SAMPLE; 243 core_dbs_info->sample_type = OD_SUB_SAMPLE;
248 delay = core_dbs_info->freq_hi_jiffies; 244 delay = core_dbs_info->freq_hi_jiffies;
249 } else {
250 delay = delay_for_sampling_rate(od_tuners->sampling_rate
251 * core_dbs_info->rate_mult);
252 } 245 }
253 } 246 }
254 247
248max_delay:
249 if (!delay)
250 delay = delay_for_sampling_rate(od_tuners->sampling_rate
251 * core_dbs_info->rate_mult);
252
255 schedule_delayed_work_on(smp_processor_id(), dw, delay); 253 schedule_delayed_work_on(smp_processor_id(), dw, delay);
256 mutex_unlock(&core_dbs_info->cdbs.timer_mutex); 254 mutex_unlock(&core_dbs_info->cdbs.timer_mutex);
257} 255}