Skip to contentSkip to conversation

cpufreq: update system-wide loops_per_jiffy only on UP

PATCH New Dominik Brodowski 1 participant 1 message Dec 21, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq: update system-wide loops_per_jiffy only on UP

loops_per_jiffy should only be updated on UP systems - on SMP the CPUs might have different such values when frequency scaling is active. On SMP it's safest to use the default value calculated during the boot process.

Dominik

kernel/cpufreq.c +11 -5
diff -ruN linux-original/kernel/cpufreq.c linux/kernel/cpufreq.c
@@ -936,17 +936,23 @@
  * adjust_jiffies - adjust the system "loops_per_jiffy"
  *
  * This function alters the system "loops_per_jiffy" for the clock
- * speed change. Note that loops_per_jiffy is only updated if all
- * CPUs are affected - else there is a need for per-CPU loops_per_jiffy
- * values which are provided by various architectures. 
+ * speed change. Note that loops_per_jiffy cannot be updated on SMP
+ * systems as each CPU might be scaled differently. So, use the arch 
+ * per-CPU loops_per_jiffy value wherever possible.
  */
+#ifndef CONFIG_SMP
 static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
 {
 	if ((val == CPUFREQ_PRECHANGE  && ci->old < ci->new) ||
 	    (val == CPUFREQ_POSTCHANGE && ci->old > ci->new))
-		if (ci->cpu == CPUFREQ_ALL_CPUS)
-			loops_per_jiffy = cpufreq_scale(loops_per_jiffy, ci->old, ci->new);
+		loops_per_jiffy = cpufreq_scale(loops_per_jiffy, ci->old, ci->new);
 }
+#else
+static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
+{
+	return;
+}
+#endif
 
 
 /**