Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'timers-urgent-2025-09-07' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull timer fix from Ingo Molnar:
"Fix a severe slowdown regression in the timer vDSO code related to the
while() loop in __iter_div_u64_rem(), when the AUX-clock is enabled"

* tag 'timers-urgent-2025-09-07' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
vdso/vsyscall: Avoid slow division loop in auxiliary clock update

+18 -5
+8 -1
include/linux/timekeeper_internal.h
··· 76 76 * @cs_was_changed_seq: The sequence number of clocksource change events 77 77 * @clock_valid: Indicator for valid clock 78 78 * @monotonic_to_boot: CLOCK_MONOTONIC to CLOCK_BOOTTIME offset 79 + * @monotonic_to_aux: CLOCK_MONOTONIC to CLOCK_AUX offset 79 80 * @cycle_interval: Number of clock cycles in one NTP interval 80 81 * @xtime_interval: Number of clock shifted nano seconds in one NTP 81 82 * interval. ··· 117 116 * 118 117 * @offs_aux is used by the auxiliary timekeepers which do not utilize any 119 118 * of the regular timekeeper offset fields. 119 + * 120 + * @monotonic_to_aux is a timespec64 representation of @offs_aux to 121 + * accelerate the VDSO update for CLOCK_AUX. 120 122 * 121 123 * The cacheline ordering of the structure is optimized for in kernel usage of 122 124 * the ktime_get() and ktime_get_ts64() family of time accessors. Struct ··· 163 159 u8 cs_was_changed_seq; 164 160 u8 clock_valid; 165 161 166 - struct timespec64 monotonic_to_boot; 162 + union { 163 + struct timespec64 monotonic_to_boot; 164 + struct timespec64 monotonic_to_aux; 165 + }; 167 166 168 167 u64 cycle_interval; 169 168 u64 xtime_interval;
+8 -2
kernel/time/timekeeping.c
··· 83 83 } 84 84 #endif 85 85 86 + static inline void tk_update_aux_offs(struct timekeeper *tk, ktime_t offs) 87 + { 88 + tk->offs_aux = offs; 89 + tk->monotonic_to_aux = ktime_to_timespec64(offs); 90 + } 91 + 86 92 /* flag for if timekeeping is suspended */ 87 93 int __read_mostly timekeeping_suspended; 88 94 ··· 1512 1506 timekeeping_restore_shadow(tkd); 1513 1507 return -EINVAL; 1514 1508 } 1515 - tks->offs_aux = offs; 1509 + tk_update_aux_offs(tks, offs); 1516 1510 } 1517 1511 1518 1512 timekeeping_update_from_shadow(tkd, TK_UPDATE_ALL); ··· 2943 2937 * xtime ("realtime") is not applicable for auxiliary clocks and 2944 2938 * kept in sync with "monotonic". 2945 2939 */ 2946 - aux_tks->offs_aux = ktime_sub(timespec64_to_ktime(*tnew), tnow); 2940 + tk_update_aux_offs(aux_tks, ktime_sub(timespec64_to_ktime(*tnew), tnow)); 2947 2941 2948 2942 timekeeping_update_from_shadow(aux_tkd, TK_UPDATE_ALL); 2949 2943 return 0;
+2 -2
kernel/time/vsyscall.c
··· 159 159 if (clock_mode != VDSO_CLOCKMODE_NONE) { 160 160 fill_clock_configuration(vc, &tk->tkr_mono); 161 161 162 - vdso_ts->sec = tk->xtime_sec; 162 + vdso_ts->sec = tk->xtime_sec + tk->monotonic_to_aux.tv_sec; 163 163 164 164 nsec = tk->tkr_mono.xtime_nsec >> tk->tkr_mono.shift; 165 - nsec += tk->offs_aux; 165 + nsec += tk->monotonic_to_aux.tv_nsec; 166 166 vdso_ts->sec += __iter_div_u64_rem(nsec, NSEC_PER_SEC, &nsec); 167 167 nsec = nsec << tk->tkr_mono.shift; 168 168 vdso_ts->nsec = nsec;