diff options
author | john stultz <johnstul@us.ibm.com> | 2009-10-02 19:24:15 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-10-05 07:52:02 -0400 |
commit | 7bc7d637452383d56ba4368d4336b0dde1bb476d (patch) | |
tree | f1c8e1e103a900850342d46de27ebdf1e7d07f78 /kernel/time/timekeeping.c | |
parent | a092ff0f90cae22b2ac8028ecd2c6f6c1a9e4601 (diff) |
time: Remove xtime_cache
With the prior logarithmic time accumulation patch, xtime will now
always be within one "tick" of the current time, instead of
possibly half a second off.
This removes the need for the xtime_cache value, which always
stored the time at the last interrupt, so this patch cleans that up
removing the xtime_cache related code.
This is a bit simpler, but still could use some wider testing.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: John Kacur <jkacur@redhat.com>
Cc: Clark Williams <williams@redhat.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
LKML-Reference: <1254525855.7741.95.camel@localhost.localdomain>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/time/timekeeping.c')
-rw-r--r-- | kernel/time/timekeeping.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 5fdd78e0858..96b3f0dfa5d 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -164,13 +164,6 @@ struct timespec raw_time; | |||
164 | /* flag for if timekeeping is suspended */ | 164 | /* flag for if timekeeping is suspended */ |
165 | int __read_mostly timekeeping_suspended; | 165 | int __read_mostly timekeeping_suspended; |
166 | 166 | ||
167 | static struct timespec xtime_cache __attribute__ ((aligned (16))); | ||
168 | void update_xtime_cache(u64 nsec) | ||
169 | { | ||
170 | xtime_cache = xtime; | ||
171 | timespec_add_ns(&xtime_cache, nsec); | ||
172 | } | ||
173 | |||
174 | /* must hold xtime_lock */ | 167 | /* must hold xtime_lock */ |
175 | void timekeeping_leap_insert(int leapsecond) | 168 | void timekeeping_leap_insert(int leapsecond) |
176 | { | 169 | { |
@@ -331,8 +324,6 @@ int do_settimeofday(struct timespec *tv) | |||
331 | 324 | ||
332 | xtime = *tv; | 325 | xtime = *tv; |
333 | 326 | ||
334 | update_xtime_cache(0); | ||
335 | |||
336 | timekeeper.ntp_error = 0; | 327 | timekeeper.ntp_error = 0; |
337 | ntp_clear(); | 328 | ntp_clear(); |
338 | 329 | ||
@@ -547,7 +538,6 @@ void __init timekeeping_init(void) | |||
547 | } | 538 | } |
548 | set_normalized_timespec(&wall_to_monotonic, | 539 | set_normalized_timespec(&wall_to_monotonic, |
549 | -boot.tv_sec, -boot.tv_nsec); | 540 | -boot.tv_sec, -boot.tv_nsec); |
550 | update_xtime_cache(0); | ||
551 | total_sleep_time.tv_sec = 0; | 541 | total_sleep_time.tv_sec = 0; |
552 | total_sleep_time.tv_nsec = 0; | 542 | total_sleep_time.tv_nsec = 0; |
553 | write_sequnlock_irqrestore(&xtime_lock, flags); | 543 | write_sequnlock_irqrestore(&xtime_lock, flags); |
@@ -581,7 +571,6 @@ static int timekeeping_resume(struct sys_device *dev) | |||
581 | wall_to_monotonic = timespec_sub(wall_to_monotonic, ts); | 571 | wall_to_monotonic = timespec_sub(wall_to_monotonic, ts); |
582 | total_sleep_time = timespec_add_safe(total_sleep_time, ts); | 572 | total_sleep_time = timespec_add_safe(total_sleep_time, ts); |
583 | } | 573 | } |
584 | update_xtime_cache(0); | ||
585 | /* re-base the last cycle value */ | 574 | /* re-base the last cycle value */ |
586 | timekeeper.clock->cycle_last = timekeeper.clock->read(timekeeper.clock); | 575 | timekeeper.clock->cycle_last = timekeeper.clock->read(timekeeper.clock); |
587 | timekeeper.ntp_error = 0; | 576 | timekeeper.ntp_error = 0; |
@@ -721,7 +710,6 @@ static void timekeeping_adjust(s64 offset) | |||
721 | timekeeper.ntp_error_shift; | 710 | timekeeper.ntp_error_shift; |
722 | } | 711 | } |
723 | 712 | ||
724 | |||
725 | /** | 713 | /** |
726 | * logarithmic_accumulation - shifted accumulation of cycles | 714 | * logarithmic_accumulation - shifted accumulation of cycles |
727 | * | 715 | * |
@@ -765,7 +753,6 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift) | |||
765 | return offset; | 753 | return offset; |
766 | } | 754 | } |
767 | 755 | ||
768 | |||
769 | /** | 756 | /** |
770 | * update_wall_time - Uses the current clocksource to increment the wall time | 757 | * update_wall_time - Uses the current clocksource to increment the wall time |
771 | * | 758 | * |
@@ -775,7 +762,6 @@ void update_wall_time(void) | |||
775 | { | 762 | { |
776 | struct clocksource *clock; | 763 | struct clocksource *clock; |
777 | cycle_t offset; | 764 | cycle_t offset; |
778 | u64 nsecs; | ||
779 | int shift = 0, maxshift; | 765 | int shift = 0, maxshift; |
780 | 766 | ||
781 | /* Make sure we're fully resumed: */ | 767 | /* Make sure we're fully resumed: */ |
@@ -841,9 +827,6 @@ void update_wall_time(void) | |||
841 | timekeeper.ntp_error += timekeeper.xtime_nsec << | 827 | timekeeper.ntp_error += timekeeper.xtime_nsec << |
842 | timekeeper.ntp_error_shift; | 828 | timekeeper.ntp_error_shift; |
843 | 829 | ||
844 | nsecs = clocksource_cyc2ns(offset, timekeeper.mult, timekeeper.shift); | ||
845 | update_xtime_cache(nsecs); | ||
846 | |||
847 | /* check to see if there is a new clocksource to use */ | 830 | /* check to see if there is a new clocksource to use */ |
848 | update_vsyscall(&xtime, timekeeper.clock); | 831 | update_vsyscall(&xtime, timekeeper.clock); |
849 | } | 832 | } |
@@ -880,13 +863,13 @@ void monotonic_to_bootbased(struct timespec *ts) | |||
880 | 863 | ||
881 | unsigned long get_seconds(void) | 864 | unsigned long get_seconds(void) |
882 | { | 865 | { |
883 | return xtime_cache.tv_sec; | 866 | return xtime.tv_sec; |
884 | } | 867 | } |
885 | EXPORT_SYMBOL(get_seconds); | 868 | EXPORT_SYMBOL(get_seconds); |
886 | 869 | ||
887 | struct timespec __current_kernel_time(void) | 870 | struct timespec __current_kernel_time(void) |
888 | { | 871 | { |
889 | return xtime_cache; | 872 | return xtime; |
890 | } | 873 | } |
891 | 874 | ||
892 | struct timespec current_kernel_time(void) | 875 | struct timespec current_kernel_time(void) |
@@ -896,8 +879,7 @@ struct timespec current_kernel_time(void) | |||
896 | 879 | ||
897 | do { | 880 | do { |
898 | seq = read_seqbegin(&xtime_lock); | 881 | seq = read_seqbegin(&xtime_lock); |
899 | 882 | now = xtime; | |
900 | now = xtime_cache; | ||
901 | } while (read_seqretry(&xtime_lock, seq)); | 883 | } while (read_seqretry(&xtime_lock, seq)); |
902 | 884 | ||
903 | return now; | 885 | return now; |
@@ -911,8 +893,7 @@ struct timespec get_monotonic_coarse(void) | |||
911 | 893 | ||
912 | do { | 894 | do { |
913 | seq = read_seqbegin(&xtime_lock); | 895 | seq = read_seqbegin(&xtime_lock); |
914 | 896 | now = xtime; | |
915 | now = xtime_cache; | ||
916 | mono = wall_to_monotonic; | 897 | mono = wall_to_monotonic; |
917 | } while (read_seqretry(&xtime_lock, seq)); | 898 | } while (read_seqretry(&xtime_lock, seq)); |
918 | 899 | ||