Signed-off-by: Thomas Gleixner --- kernel/time/timekeeping.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) Index: linux-2.6-tip/kernel/time/timekeeping.c =================================================================== --- linux-2.6-tip.orig/kernel/time/timekeeping.c +++ linux-2.6-tip/kernel/time/timekeeping.c @@ -170,14 +170,23 @@ static struct timespec raw_time; /* flag for if timekeeping is suspended */ int __read_mostly timekeeping_suspended; +static void timekeeping_update(bool clearntp) +{ + if (clearntp) { + timekeeper.ntp_error = 0; + ntp_clear(); + } + update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, + timekeeper.mult); +} + /* must hold xtime_lock */ void timekeeping_leap_insert(int leapsecond) { write_seqcount_begin(&xtime_seq); xtime.tv_sec += leapsecond; wall_to_monotonic.tv_sec -= leapsecond; - update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, - timekeeper.mult); + timekeeping_update(false); write_seqcount_end(&xtime_seq); } @@ -375,12 +384,7 @@ int do_settimeofday(const struct timespe xtime = *tv; - timekeeper.ntp_error = 0; - ntp_clear(); - - update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, - timekeeper.mult); - + timekeeping_update(true); write_seqcount_end(&xtime_seq); raw_spin_unlock_irqrestore(&xtime_lock, flags); @@ -414,12 +418,7 @@ int timekeeping_inject_offset(struct tim xtime = timespec_add(xtime, *ts); wall_to_monotonic = timespec_sub(wall_to_monotonic, *ts); - timekeeper.ntp_error = 0; - ntp_clear(); - - update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, - timekeeper.mult); - + timekeeping_update(true); write_seqcount_end(&xtime_seq); raw_spin_unlock_irqrestore(&xtime_lock, flags); @@ -651,11 +650,7 @@ void timekeeping_inject_sleeptime(struct __timekeeping_inject_sleeptime(delta); - timekeeper.ntp_error = 0; - ntp_clear(); - update_vsyscall(&xtime, &wall_to_monotonic, timekeeper.clock, - timekeeper.mult); - + timekeeping_update(true); write_seqcount_end(&xtime_seq); raw_spin_unlock_irqrestore(&xtime_lock, flags); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/