diff options
author | john stultz <johnstul@us.ibm.com> | 2007-07-24 20:47:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-25 13:09:20 -0400 |
commit | 2c6b47de17c75d553de3e2fb426d8298d2074585 (patch) | |
tree | c8edc3d727d85cb3e1c043583c350a04a133e1a3 /kernel/time | |
parent | 0de085bb474f64e4fdb2f1ff3268590792648c7b (diff) |
Cleanup non-arch xtime uses, use get_seconds() or current_kernel_time().
This avoids use of the kernel-internal "xtime" variable directly outside
of the actual time-related functions. Instead, use the helper functions
that we already have available to us.
This doesn't actually change any behaviour, but this will allow us to
fix the fact that "xtime" isn't updated very often with CONFIG_NO_HZ
(because much of the realtime information is maintained as separate
offsets to 'xtime'), which has caused interfaces that use xtime directly
to get a time that is out of sync with the real-time clock by up to a
third of a second or so.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/timekeeping.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 88c81026e003..07a3f1420c27 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -509,3 +509,19 @@ void monotonic_to_bootbased(struct timespec *ts) | |||
509 | { | 509 | { |
510 | ts->tv_sec += total_sleep_time; | 510 | ts->tv_sec += total_sleep_time; |
511 | } | 511 | } |
512 | |||
513 | struct timespec current_kernel_time(void) | ||
514 | { | ||
515 | struct timespec now; | ||
516 | unsigned long seq; | ||
517 | |||
518 | do { | ||
519 | seq = read_seqbegin(&xtime_lock); | ||
520 | |||
521 | now = xtime; | ||
522 | } while (read_seqretry(&xtime_lock, seq)); | ||
523 | |||
524 | return now; | ||
525 | } | ||
526 | |||
527 | EXPORT_SYMBOL(current_kernel_time); | ||