diff options
| author | John Stultz <john.stultz@linaro.org> | 2011-11-14 14:43:49 -0500 |
|---|---|---|
| committer | John Stultz <john.stultz@linaro.org> | 2012-01-26 22:44:14 -0500 |
| commit | 01f71b47e08f2a062c4e77c94dfa9a7e0ae65fcb (patch) | |
| tree | bad9a642d8f55def709d71ecc9affe78ecc59e42 /kernel/time | |
| parent | 8ff2cb92dd1afcf23e7b5287c43a900b16f40bad (diff) | |
time: Move raw_time into timekeeper structure
In preparation for locking cleanups, move raw_time into
timekeeper structure.
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/time')
| -rw-r--r-- | kernel/time/timekeeping.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index b30ffe6c6b06..fbbc3c7ce7df 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
| @@ -67,7 +67,8 @@ struct timekeeper { | |||
| 67 | struct timespec wall_to_monotonic; | 67 | struct timespec wall_to_monotonic; |
| 68 | /* time spent in suspend */ | 68 | /* time spent in suspend */ |
| 69 | struct timespec total_sleep_time; | 69 | struct timespec total_sleep_time; |
| 70 | 70 | /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */ | |
| 71 | struct timespec raw_time; | ||
| 71 | }; | 72 | }; |
| 72 | 73 | ||
| 73 | static struct timekeeper timekeeper; | 74 | static struct timekeeper timekeeper; |
| @@ -164,10 +165,6 @@ __cacheline_aligned_in_smp DEFINE_SEQLOCK(xtime_lock); | |||
| 164 | 165 | ||
| 165 | 166 | ||
| 166 | 167 | ||
| 167 | /* | ||
| 168 | * The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. | ||
| 169 | */ | ||
| 170 | static struct timespec raw_time; | ||
| 171 | 168 | ||
| 172 | /* flag for if timekeeping is suspended */ | 169 | /* flag for if timekeeping is suspended */ |
| 173 | int __read_mostly timekeeping_suspended; | 170 | int __read_mostly timekeeping_suspended; |
| @@ -208,7 +205,7 @@ static void timekeeping_forward_now(void) | |||
| 208 | timespec_add_ns(&timekeeper.xtime, nsec); | 205 | timespec_add_ns(&timekeeper.xtime, nsec); |
| 209 | 206 | ||
| 210 | nsec = clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift); | 207 | nsec = clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift); |
| 211 | timespec_add_ns(&raw_time, nsec); | 208 | timespec_add_ns(&timekeeper.raw_time, nsec); |
| 212 | } | 209 | } |
| 213 | 210 | ||
| 214 | /** | 211 | /** |
| @@ -320,7 +317,7 @@ void getnstime_raw_and_real(struct timespec *ts_raw, struct timespec *ts_real) | |||
| 320 | 317 | ||
| 321 | seq = read_seqbegin(&xtime_lock); | 318 | seq = read_seqbegin(&xtime_lock); |
| 322 | 319 | ||
| 323 | *ts_raw = raw_time; | 320 | *ts_raw = timekeeper.raw_time; |
| 324 | *ts_real = timekeeper.xtime; | 321 | *ts_real = timekeeper.xtime; |
| 325 | 322 | ||
| 326 | nsecs_raw = timekeeping_get_ns_raw(); | 323 | nsecs_raw = timekeeping_get_ns_raw(); |
| @@ -499,7 +496,7 @@ void getrawmonotonic(struct timespec *ts) | |||
| 499 | do { | 496 | do { |
| 500 | seq = read_seqbegin(&xtime_lock); | 497 | seq = read_seqbegin(&xtime_lock); |
| 501 | nsecs = timekeeping_get_ns_raw(); | 498 | nsecs = timekeeping_get_ns_raw(); |
| 502 | *ts = raw_time; | 499 | *ts = timekeeper.raw_time; |
| 503 | 500 | ||
| 504 | } while (read_seqretry(&xtime_lock, seq)); | 501 | } while (read_seqretry(&xtime_lock, seq)); |
| 505 | 502 | ||
| @@ -590,8 +587,8 @@ void __init timekeeping_init(void) | |||
| 590 | 587 | ||
| 591 | timekeeper.xtime.tv_sec = now.tv_sec; | 588 | timekeeper.xtime.tv_sec = now.tv_sec; |
| 592 | timekeeper.xtime.tv_nsec = now.tv_nsec; | 589 | timekeeper.xtime.tv_nsec = now.tv_nsec; |
| 593 | raw_time.tv_sec = 0; | 590 | timekeeper.raw_time.tv_sec = 0; |
| 594 | raw_time.tv_nsec = 0; | 591 | timekeeper.raw_time.tv_nsec = 0; |
| 595 | if (boot.tv_sec == 0 && boot.tv_nsec == 0) { | 592 | if (boot.tv_sec == 0 && boot.tv_nsec == 0) { |
| 596 | boot.tv_sec = timekeeper.xtime.tv_sec; | 593 | boot.tv_sec = timekeeper.xtime.tv_sec; |
| 597 | boot.tv_nsec = timekeeper.xtime.tv_nsec; | 594 | boot.tv_nsec = timekeeper.xtime.tv_nsec; |
| @@ -958,13 +955,13 @@ static cycle_t logarithmic_accumulation(cycle_t offset, int shift) | |||
| 958 | 955 | ||
| 959 | /* Accumulate raw time */ | 956 | /* Accumulate raw time */ |
| 960 | raw_nsecs = timekeeper.raw_interval << shift; | 957 | raw_nsecs = timekeeper.raw_interval << shift; |
| 961 | raw_nsecs += raw_time.tv_nsec; | 958 | raw_nsecs += timekeeper.raw_time.tv_nsec; |
| 962 | if (raw_nsecs >= NSEC_PER_SEC) { | 959 | if (raw_nsecs >= NSEC_PER_SEC) { |
| 963 | u64 raw_secs = raw_nsecs; | 960 | u64 raw_secs = raw_nsecs; |
| 964 | raw_nsecs = do_div(raw_secs, NSEC_PER_SEC); | 961 | raw_nsecs = do_div(raw_secs, NSEC_PER_SEC); |
| 965 | raw_time.tv_sec += raw_secs; | 962 | timekeeper.raw_time.tv_sec += raw_secs; |
| 966 | } | 963 | } |
| 967 | raw_time.tv_nsec = raw_nsecs; | 964 | timekeeper.raw_time.tv_nsec = raw_nsecs; |
| 968 | 965 | ||
| 969 | /* Accumulate error between NTP and clock interval */ | 966 | /* Accumulate error between NTP and clock interval */ |
| 970 | timekeeper.ntp_error += tick_length << shift; | 967 | timekeeper.ntp_error += tick_length << shift; |
