Commit 31089c13bcb18d2cd2a3ddfbe3a28666346f237e
Committed by
Thomas Gleixner
1 parent
4cd1993f00
Exists in
master
and in
7 other branches
timekeeping: Introduce timekeeping_leap_insert
Move the adjustment of xtime, wall_to_monotonic and the update of the vsyscall variables to the timekeeping code. Signed-off-by: John Stultz <johnstul@us.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> LKML-Reference: <20090814134807.609730216@de.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Showing 3 changed files with 10 additions and 5 deletions Side-by-side Diff
include/linux/time.h
... | ... | @@ -147,6 +147,7 @@ |
147 | 147 | extern int timekeeping_valid_for_hres(void); |
148 | 148 | extern void update_wall_time(void); |
149 | 149 | extern void update_xtime_cache(u64 nsec); |
150 | +extern void timekeeping_leap_insert(int leapsecond); | |
150 | 151 | |
151 | 152 | struct tms; |
152 | 153 | extern void do_sys_times(struct tms *); |
kernel/time/ntp.c
... | ... | @@ -194,8 +194,7 @@ |
194 | 194 | case TIME_OK: |
195 | 195 | break; |
196 | 196 | case TIME_INS: |
197 | - xtime.tv_sec--; | |
198 | - wall_to_monotonic.tv_sec++; | |
197 | + timekeeping_leap_insert(-1); | |
199 | 198 | time_state = TIME_OOP; |
200 | 199 | printk(KERN_NOTICE |
201 | 200 | "Clock: inserting leap second 23:59:60 UTC\n"); |
202 | 201 | |
... | ... | @@ -203,9 +202,8 @@ |
203 | 202 | res = HRTIMER_RESTART; |
204 | 203 | break; |
205 | 204 | case TIME_DEL: |
206 | - xtime.tv_sec++; | |
205 | + timekeeping_leap_insert(1); | |
207 | 206 | time_tai--; |
208 | - wall_to_monotonic.tv_sec--; | |
209 | 207 | time_state = TIME_WAIT; |
210 | 208 | printk(KERN_NOTICE |
211 | 209 | "Clock: deleting leap second 23:59:59 UTC\n"); |
... | ... | @@ -219,7 +217,6 @@ |
219 | 217 | time_state = TIME_OK; |
220 | 218 | break; |
221 | 219 | } |
222 | - update_vsyscall(&xtime, clock); | |
223 | 220 | |
224 | 221 | write_sequnlock(&xtime_lock); |
225 | 222 |
kernel/time/timekeeping.c
... | ... | @@ -58,6 +58,13 @@ |
58 | 58 | |
59 | 59 | struct clocksource *clock; |
60 | 60 | |
61 | +/* must hold xtime_lock */ | |
62 | +void timekeeping_leap_insert(int leapsecond) | |
63 | +{ | |
64 | + xtime.tv_sec += leapsecond; | |
65 | + wall_to_monotonic.tv_sec -= leapsecond; | |
66 | + update_vsyscall(&xtime, clock); | |
67 | +} | |
61 | 68 | |
62 | 69 | #ifdef CONFIG_GENERIC_TIME |
63 | 70 | /** |