diff options
| -rw-r--r-- | kernel/time/timekeeping.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 269b1fe5f2ae..c2f12aa87fce 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
| @@ -24,32 +24,31 @@ | |||
| 24 | /* Structure holding internal timekeeping values. */ | 24 | /* Structure holding internal timekeeping values. */ |
| 25 | struct timekeeper { | 25 | struct timekeeper { |
| 26 | /* Current clocksource used for timekeeping. */ | 26 | /* Current clocksource used for timekeeping. */ |
| 27 | struct clocksource *clock; | 27 | struct clocksource *clock; |
| 28 | /* NTP adjusted clock multiplier */ | 28 | /* NTP adjusted clock multiplier */ |
| 29 | u32 mult; | 29 | u32 mult; |
| 30 | /* The shift value of the current clocksource. */ | 30 | /* The shift value of the current clocksource. */ |
| 31 | int shift; | 31 | int shift; |
| 32 | |||
| 33 | /* Number of clock cycles in one NTP interval. */ | 32 | /* Number of clock cycles in one NTP interval. */ |
| 34 | cycle_t cycle_interval; | 33 | cycle_t cycle_interval; |
| 35 | /* Number of clock shifted nano seconds in one NTP interval. */ | 34 | /* Number of clock shifted nano seconds in one NTP interval. */ |
| 36 | u64 xtime_interval; | 35 | u64 xtime_interval; |
| 37 | /* shifted nano seconds left over when rounding cycle_interval */ | 36 | /* shifted nano seconds left over when rounding cycle_interval */ |
| 38 | s64 xtime_remainder; | 37 | s64 xtime_remainder; |
| 39 | /* Raw nano seconds accumulated per NTP interval. */ | 38 | /* Raw nano seconds accumulated per NTP interval. */ |
| 40 | u32 raw_interval; | 39 | u32 raw_interval; |
| 41 | 40 | ||
| 42 | /* Clock shifted nano seconds remainder not stored in xtime.tv_nsec. */ | 41 | /* Clock shifted nano seconds remainder not stored in xtime.tv_nsec. */ |
| 43 | u64 xtime_nsec; | 42 | u64 xtime_nsec; |
| 44 | /* Difference between accumulated time and NTP time in ntp | 43 | /* Difference between accumulated time and NTP time in ntp |
| 45 | * shifted nano seconds. */ | 44 | * shifted nano seconds. */ |
| 46 | s64 ntp_error; | 45 | s64 ntp_error; |
| 47 | /* Shift conversion between clock shifted nano seconds and | 46 | /* Shift conversion between clock shifted nano seconds and |
| 48 | * ntp shifted nano seconds. */ | 47 | * ntp shifted nano seconds. */ |
| 49 | int ntp_error_shift; | 48 | int ntp_error_shift; |
| 50 | 49 | ||
| 51 | /* The current time */ | 50 | /* The current time */ |
| 52 | struct timespec xtime; | 51 | struct timespec xtime; |
| 53 | /* | 52 | /* |
| 54 | * wall_to_monotonic is what we need to add to xtime (or xtime corrected | 53 | * wall_to_monotonic is what we need to add to xtime (or xtime corrected |
| 55 | * for sub jiffie times) to get to monotonic time. Monotonic is pegged | 54 | * for sub jiffie times) to get to monotonic time. Monotonic is pegged |
| @@ -64,20 +63,17 @@ struct timekeeper { | |||
| 64 | * - wall_to_monotonic is no longer the boot time, getboottime must be | 63 | * - wall_to_monotonic is no longer the boot time, getboottime must be |
| 65 | * used instead. | 64 | * used instead. |
| 66 | */ | 65 | */ |
| 67 | struct timespec wall_to_monotonic; | 66 | struct timespec wall_to_monotonic; |
| 68 | /* time spent in suspend */ | 67 | /* time spent in suspend */ |
| 69 | struct timespec total_sleep_time; | 68 | struct timespec total_sleep_time; |
| 70 | /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */ | 69 | /* The raw monotonic time for the CLOCK_MONOTONIC_RAW posix clock. */ |
| 71 | struct timespec raw_time; | 70 | struct timespec raw_time; |
| 72 | |||
| 73 | /* Offset clock monotonic -> clock realtime */ | 71 | /* Offset clock monotonic -> clock realtime */ |
| 74 | ktime_t offs_real; | 72 | ktime_t offs_real; |
| 75 | |||
| 76 | /* Offset clock monotonic -> clock boottime */ | 73 | /* Offset clock monotonic -> clock boottime */ |
| 77 | ktime_t offs_boot; | 74 | ktime_t offs_boot; |
| 78 | |||
| 79 | /* Seqlock for all timekeeper values */ | 75 | /* Seqlock for all timekeeper values */ |
| 80 | seqlock_t lock; | 76 | seqlock_t lock; |
| 81 | }; | 77 | }; |
| 82 | 78 | ||
| 83 | static struct timekeeper timekeeper; | 79 | static struct timekeeper timekeeper; |
| @@ -547,6 +543,7 @@ u64 timekeeping_max_deferment(void) | |||
| 547 | { | 543 | { |
| 548 | unsigned long seq; | 544 | unsigned long seq; |
| 549 | u64 ret; | 545 | u64 ret; |
| 546 | |||
| 550 | do { | 547 | do { |
| 551 | seq = read_seqbegin(&timekeeper.lock); | 548 | seq = read_seqbegin(&timekeeper.lock); |
| 552 | 549 | ||
