mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 01:54:09 +08:00
timekeeping: Read NTP tick length only once
No point in reading it a second time when the comparison fails. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Anna-Maria Behnsen <anna-maria@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: John Stultz <jstultz@google.com> Link: https://lore.kernel.org/all/20241009-devel-anna-maria-b4-timers-ptp-timekeeping-v2-1-554456a44a15@linutronix.de
This commit is contained in:
parent
2e529e637c
commit
14f1e3b3df
@ -2161,16 +2161,17 @@ static __always_inline void timekeeping_apply_adjustment(struct timekeeper *tk,
|
||||
*/
|
||||
static void timekeeping_adjust(struct timekeeper *tk, s64 offset)
|
||||
{
|
||||
u64 ntp_tl = ntp_tick_length();
|
||||
u32 mult;
|
||||
|
||||
/*
|
||||
* Determine the multiplier from the current NTP tick length.
|
||||
* Avoid expensive division when the tick length doesn't change.
|
||||
*/
|
||||
if (likely(tk->ntp_tick == ntp_tick_length())) {
|
||||
if (likely(tk->ntp_tick == ntp_tl)) {
|
||||
mult = tk->tkr_mono.mult - tk->ntp_err_mult;
|
||||
} else {
|
||||
tk->ntp_tick = ntp_tick_length();
|
||||
tk->ntp_tick = ntp_tl;
|
||||
mult = div64_u64((tk->ntp_tick >> tk->ntp_error_shift) -
|
||||
tk->xtime_remainder, tk->cycle_interval);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user