summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorDominik Brodowski <linux@brodo.de>2003-01-05 16:14:29 -0800
committerLinus Torvalds <torvalds@home.transmeta.com>2003-01-05 16:14:29 -0800
commit73c11c16a84cc88676fc5c7243d4e2d4b6e47ff6 (patch)
treede25fd23eedcdf774bf6940932e303b49d039907 /kernel
parent19accb694bfe0b7e79cf629e7658ed6768a54adb (diff)
[PATCH] cpufreq: update timer notifier
- global loops_per_jiffy, x86 cpu_khz and x86 fast_gettimeoffset_quotient can only be safely adjusted on UP - x86 per-CPU loops_per_jiffy does not depend on TSC - save reference values so that rounding errors do not accumulate
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpufreq.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/kernel/cpufreq.c b/kernel/cpufreq.c
index 5dff6da1a73f..c0be78462c81 100644
--- a/kernel/cpufreq.c
+++ b/kernel/cpufreq.c
@@ -927,17 +927,27 @@ EXPORT_SYMBOL(cpufreq_set_policy);
* 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 unsigned long l_p_j_ref = 0;
+static unsigned int l_p_j_ref_freq = 0;
+
static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci)
{
+ if (!l_p_j_ref_freq) {
+ l_p_j_ref = loops_per_jiffy;
+ l_p_j_ref_freq = ci->old;
+ }
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(l_p_j_ref, l_p_j_ref_freq, ci->new);
}
+#else
+#define adjust_jiffies(...)
+#endif
/**