diff options
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 52cf1f021825..f507a869acbc 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -305,6 +305,9 @@ static void do_dbs_timer(void *data) | |||
305 | { | 305 | { |
306 | unsigned int cpu = smp_processor_id(); | 306 | unsigned int cpu = smp_processor_id(); |
307 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); | 307 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); |
308 | /* We want all CPUs to do sampling nearly on same jiffy */ | ||
309 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); | ||
310 | delay -= jiffies % delay; | ||
308 | 311 | ||
309 | if (!dbs_info->enable) | 312 | if (!dbs_info->enable) |
310 | return; | 313 | return; |
@@ -312,18 +315,18 @@ static void do_dbs_timer(void *data) | |||
312 | lock_cpu_hotplug(); | 315 | lock_cpu_hotplug(); |
313 | dbs_check_cpu(dbs_info); | 316 | dbs_check_cpu(dbs_info); |
314 | unlock_cpu_hotplug(); | 317 | unlock_cpu_hotplug(); |
315 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, | 318 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); |
316 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); | ||
317 | } | 319 | } |
318 | 320 | ||
319 | static inline void dbs_timer_init(unsigned int cpu) | 321 | static inline void dbs_timer_init(unsigned int cpu) |
320 | { | 322 | { |
321 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); | 323 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); |
324 | /* We want all CPUs to do sampling nearly on same jiffy */ | ||
325 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); | ||
326 | delay -= jiffies % delay; | ||
322 | 327 | ||
323 | INIT_WORK(&dbs_info->work, do_dbs_timer, 0); | 328 | INIT_WORK(&dbs_info->work, do_dbs_timer, 0); |
324 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, | 329 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); |
325 | usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); | ||
326 | return; | ||
327 | } | 330 | } |
328 | 331 | ||
329 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) | 332 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) |