[CPUFREQ] ondemand: don't synchronize sample rate unless multiple cpus present
authorJocelyn Falempe <jocelyn.falempe@motorola.com>
Thu, 11 Mar 2010 22:01:11 +0000 (14:01 -0800)
committerDave Jones <davej@redhat.com>
Tue, 3 Aug 2010 17:47:04 +0000 (13:47 -0400)
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>
drivers/cpufreq/cpufreq_ondemand.c

index fecfcdda6ddd2e0e42d5b7bfd24fcf8d103b6360..7b5093664e49ba4d2172cd208c5d6ae7b7b419ee 100644 (file)
@@ -609,7 +609,9 @@ static void do_dbs_timer(struct work_struct *work)
        /* We want all CPUs to do sampling nearly on same jiffy */
        int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
 
-       delay -= jiffies % delay;
+       if (num_online_cpus() > 1)
+               delay -= jiffies % delay;
+
        mutex_lock(&dbs_info->timer_mutex);
 
        /* Common NORMAL_SAMPLE setup */
@@ -634,7 +636,9 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info)
 {
        /* We want all CPUs to do sampling nearly on same jiffy */
        int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate);
-       delay -= jiffies % delay;
+
+       if (num_online_cpus() > 1)
+               delay -= jiffies % delay;
 
        dbs_info->sample_type = DBS_NORMAL_SAMPLE;
        INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer);