diff options
author | Ingo Molnar <mingo@elte.hu> | 2007-07-09 12:51:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2007-07-09 12:51:59 -0400 |
commit | bb29ab26863c022743143f27956cc0ca362f258c (patch) | |
tree | f8106b8a82d4abe9c3b217c7ca96307539a945ad /arch/i386 | |
parent | dd41f596cda0d7d6e4a8b139ffdfabcefdd46528 (diff) |
sched: x86, track TSC-unstable events
track TSC-unstable events and propagate it to the scheduler code.
Also allow sched_clock() to be used when the TSC is unstable,
the rq_clock() wrapper creates a reliable clock out of it.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/i386')
-rw-r--r-- | arch/i386/kernel/tsc.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/arch/i386/kernel/tsc.c b/arch/i386/kernel/tsc.c index f64b81f3033..ea63a30ca3e 100644 --- a/arch/i386/kernel/tsc.c +++ b/arch/i386/kernel/tsc.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * See comments there for proper credits. | 4 | * See comments there for proper credits. |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/sched.h> | ||
7 | #include <linux/clocksource.h> | 8 | #include <linux/clocksource.h> |
8 | #include <linux/workqueue.h> | 9 | #include <linux/workqueue.h> |
9 | #include <linux/cpufreq.h> | 10 | #include <linux/cpufreq.h> |
@@ -106,8 +107,13 @@ unsigned long long sched_clock(void) | |||
106 | 107 | ||
107 | /* | 108 | /* |
108 | * Fall back to jiffies if there's no TSC available: | 109 | * Fall back to jiffies if there's no TSC available: |
110 | * ( But note that we still use it if the TSC is marked | ||
111 | * unstable. We do this because unlike Time Of Day, | ||
112 | * the scheduler clock tolerates small errors and it's | ||
113 | * very important for it to be as fast as the platform | ||
114 | * can achive it. ) | ||
109 | */ | 115 | */ |
110 | if (unlikely(!tsc_enabled)) | 116 | if (unlikely(!tsc_enabled && !tsc_unstable)) |
111 | /* No locking but a rare wrong value is not a big deal: */ | 117 | /* No locking but a rare wrong value is not a big deal: */ |
112 | return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ); | 118 | return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ); |
113 | 119 | ||
@@ -277,6 +283,7 @@ static struct clocksource clocksource_tsc = { | |||
277 | 283 | ||
278 | void mark_tsc_unstable(char *reason) | 284 | void mark_tsc_unstable(char *reason) |
279 | { | 285 | { |
286 | sched_clock_unstable_event(); | ||
280 | if (!tsc_unstable) { | 287 | if (!tsc_unstable) { |
281 | tsc_unstable = 1; | 288 | tsc_unstable = 1; |
282 | tsc_enabled = 0; | 289 | tsc_enabled = 0; |