aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorJocelyn Falempe <jocelyn.falempe@motorola.com>2010-03-11 17:01:11 -0500
committerDave Jones <davej@redhat.com>2010-08-03 13:47:04 -0400
commita665df9d510bfd5bac5664f436411f921471264a (patch)
tree0814b40d3cf1974f0b6c9ad844d38d278fd0e458 /drivers/cpufreq
parent226528c6100e4191842e61997110c8ace40605f7 (diff)
[CPUFREQ] ondemand: don't synchronize sample rate unless multiple cpus present
For UP systems this is not required, and results in a more consistent sample interval. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Jocelyn Falempe <jocelyn.falempe@motorola.com> Signed-off-by: Mike Chan <mike@android.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Dave Jones <davej@redhat.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index fecfcdda6ddd..7b5093664e49 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -609,7 +609,9 @@ static void do_dbs_timer(struct work_struct *work)
609 /* We want all CPUs to do sampling nearly on same jiffy */ 609 /* We want all CPUs to do sampling nearly on same jiffy */
610 int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); 610 int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
611 611
612 delay -= jiffies % delay; 612 if (num_online_cpus() > 1)
613 delay -= jiffies % delay;
614
613 mutex_lock(&dbs_info->timer_mutex); 615 mutex_lock(&dbs_info->timer_mutex);
614 616
615 /* Common NORMAL_SAMPLE setup */ 617 /* Common NORMAL_SAMPLE setup */
@@ -634,7 +636,9 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
634{ 636{
635 /* We want all CPUs to do sampling nearly on same jiffy */ 637 /* We want all CPUs to do sampling nearly on same jiffy */
636 int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); 638 int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
637 delay -= jiffies % delay; 639
640 if (num_online_cpus() > 1)
641 delay -= jiffies % delay;
638 642
639 dbs_info->sample_type = DBS_NORMAL_SAMPLE; 643 dbs_info->sample_type = DBS_NORMAL_SAMPLE;
640 INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer); 644 INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer);