Commit 9ec72638 authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Willy Tarreau

time: Move common updates to a function

This is a backport of cc06268c

While not a bugfix itself, it allows following fixes to backport
in a more straightforward manner.

CC: Thomas Gleixner <tglx@linutronix.de>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>
Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
Signed-off-by: default avatarWilly Tarreau <w@1wt.eu>
parent af54f209
......@@ -166,6 +166,18 @@ static struct timespec total_sleep_time;
*/
struct timespec raw_time;
/* must hold write on xtime_lock */
static void timekeeping_update(bool clearntp)
{
if (clearntp) {
timekeeper.ntp_error = 0;
ntp_clear();
}
update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult);
}
/* flag for if timekeeping is suspended */
int __read_mostly timekeeping_suspended;
......@@ -341,10 +353,7 @@ int do_settimeofday(struct timespec *tv)
update_xtime_cache(0);
timekeeper.ntp_error = 0;
ntp_clear();
update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult);
timekeeping_update(true);
write_sequnlock_irqrestore(&xtime_lock, flags);
......@@ -832,8 +841,7 @@ void update_wall_time(void)
nsecs = clocksource_cyc2ns(offset, timekeeper.mult, timekeeper.shift);
update_xtime_cache(nsecs);
/* check to see if there is a new clocksource to use */
update_vsyscall(&xtime, timekeeper.clock, timekeeper.mult);
timekeeping_update(false);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment