Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 58286
b: refs/heads/master
c: bb29ab2
h: refs/heads/master
v: v3
  • Loading branch information
Ingo Molnar committed Jul 9, 2007
1 parent 2c733a4 commit 6a8740d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dd41f596cda0d7d6e4a8b139ffdfabcefdd46528
refs/heads/master: bb29ab26863c022743143f27956cc0ca362f258c
9 changes: 8 additions & 1 deletion trunk/arch/i386/kernel/tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* See comments there for proper credits.
*/

#include <linux/sched.h>
#include <linux/clocksource.h>
#include <linux/workqueue.h>
#include <linux/cpufreq.h>
Expand Down Expand Up @@ -106,8 +107,13 @@ unsigned long long sched_clock(void)

/*
* Fall back to jiffies if there's no TSC available:
* ( But note that we still use it if the TSC is marked
* unstable. We do this because unlike Time Of Day,
* the scheduler clock tolerates small errors and it's
* very important for it to be as fast as the platform
* can achive it. )
*/
if (unlikely(!tsc_enabled))
if (unlikely(!tsc_enabled && !tsc_unstable))
/* No locking but a rare wrong value is not a big deal: */
return (jiffies_64 - INITIAL_JIFFIES) * (1000000000 / HZ);

Expand Down Expand Up @@ -277,6 +283,7 @@ static struct clocksource clocksource_tsc = {

void mark_tsc_unstable(char *reason)
{
sched_clock_unstable_event();
if (!tsc_unstable) {
tsc_unstable = 1;
tsc_enabled = 0;
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,8 @@ extern void sched_exec(void);
#define sched_exec() {}
#endif

extern void sched_clock_unstable_event(void);

#ifdef CONFIG_HOTPLUG_CPU
extern void idle_task_exit(void);
#else
Expand Down
7 changes: 7 additions & 0 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ unsigned long long __attribute__((weak)) sched_clock(void)
return (unsigned long long)jiffies * (1000000000 / HZ);
}

/*
* CPU frequency is/was unstable - start new by setting prev_clock_raw:
*/
void sched_clock_unstable_event(void)
{
}

/*
* Convert user-nice values [ -20 ... 0 ... 19 ]
* to static priority [ MAX_RT_PRIO..MAX_PRIO-1 ],
Expand Down

0 comments on commit 6a8740d

Please sign in to comment.