Skip to contentSkip to conversation

cpufreq: ondemand: Don't synchronize sample rate unless mulitple cpus present

PATCH New Mike Chan 1 participant 1 message Jan 13, 2010 CPU frequency scaling framework

lore
Share & tools
lore

Mike Chan

author
#0 lore raw

PATCH 1/1 cpufreq: ondemand: Don't synchronize sample rate unless mulitple cpus present

From: Jocelyn Falempe <[email protected]>

For UP systems this is not required, and results in a more consistent sample interval.

---
 drivers/cpufreq/cpufreq_ondemand.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
drivers/cpufreq/cpufreq_ondemand.c +6 -2
index 4b34ade..d139558 100644
@@ -576,7 +576,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 */
@@ -601,7 +603,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);
Signature · 1 line
1.6.6