diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2008-05-03 12:29:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-05-05 17:56:18 -0400 |
commit | 3e51f33fcc7f55e6df25d15b55ed10c8b4da84cd (patch) | |
tree | 3752f9ea8e014ec40e95a1b197b0a3d18e1056a8 /include/linux/sched.h | |
parent | a5574cf65b5f03ce9ade3918764fe22e5e2371e3 (diff) |
sched: add optional support for CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
this replaces the rq->clock stuff (and possibly cpu_clock()).
- architectures that have an 'imperfect' hardware clock can set
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK
- the 'jiffie' window might be superfulous when we update tick_gtod
before the __update_sched_clock() call in sched_clock_tick()
- cpu_clock() might be implemented as:
sched_clock_cpu(smp_processor_id())
if the accuracy proves good enough - how far can TSC drift in a
single jiffie when considering the filtering and idle hooks?
[ mingo@elte.hu: various fixes and cleanups ]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 54c9ca26b7d8..0c35b0343a76 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -1553,6 +1553,35 @@ static inline int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) | |||
1553 | 1553 | ||
1554 | extern unsigned long long sched_clock(void); | 1554 | extern unsigned long long sched_clock(void); |
1555 | 1555 | ||
1556 | #ifndef CONFIG_HAVE_UNSTABLE_SCHED_CLOCK | ||
1557 | static inline void sched_clock_init(void) | ||
1558 | { | ||
1559 | } | ||
1560 | |||
1561 | static inline u64 sched_clock_cpu(int cpu) | ||
1562 | { | ||
1563 | return sched_clock(); | ||
1564 | } | ||
1565 | |||
1566 | static inline void sched_clock_tick(void) | ||
1567 | { | ||
1568 | } | ||
1569 | |||
1570 | static inline void sched_clock_idle_sleep_event(void) | ||
1571 | { | ||
1572 | } | ||
1573 | |||
1574 | static inline void sched_clock_idle_wakeup_event(u64 delta_ns) | ||
1575 | { | ||
1576 | } | ||
1577 | #else | ||
1578 | extern void sched_clock_init(void); | ||
1579 | extern u64 sched_clock_cpu(int cpu); | ||
1580 | extern void sched_clock_tick(void); | ||
1581 | extern void sched_clock_idle_sleep_event(void); | ||
1582 | extern void sched_clock_idle_wakeup_event(u64 delta_ns); | ||
1583 | #endif | ||
1584 | |||
1556 | /* | 1585 | /* |
1557 | * For kernel-internal use: high-speed (but slightly incorrect) per-cpu | 1586 | * For kernel-internal use: high-speed (but slightly incorrect) per-cpu |
1558 | * clock constructed from sched_clock(): | 1587 | * clock constructed from sched_clock(): |