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.

timekeeping: Provide update for auxiliary timekeepers

Update the auxiliary timekeepers periodically. For now this is tied to the system
timekeeper update from the tick. This might be revisited and moved out of the tick.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: John Stultz <jstultz@google.com>
Link: https://lore.kernel.org/all/20250625183758.382451331@linutronix.de

+19
+19
kernel/time/timekeeping.c
··· 131 131 #ifdef CONFIG_POSIX_AUX_CLOCKS 132 132 static __init void tk_aux_setup(void); 133 133 static void tk_aux_update_clocksource(void); 134 + static void tk_aux_advance(void); 134 135 #else 135 136 static inline void tk_aux_setup(void) { } 136 137 static inline void tk_aux_update_clocksource(void) { } 138 + static inline void tk_aux_advance(void) { } 137 139 #endif 138 140 139 141 unsigned long timekeeper_lock_irqsave(void) ··· 2319 2317 /** 2320 2318 * update_wall_time - Uses the current clocksource to increment the wall time 2321 2319 * 2320 + * It also updates the enabled auxiliary clock timekeepers 2322 2321 */ 2323 2322 void update_wall_time(void) 2324 2323 { 2325 2324 if (timekeeping_advance(TK_ADV_TICK)) 2326 2325 clock_was_set_delayed(); 2326 + tk_aux_advance(); 2327 2327 } 2328 2328 2329 2329 /** ··· 2765 2761 timekeeping_forward_now(tks); 2766 2762 tk_setup_internals(tks, tk_core.timekeeper.tkr_mono.clock); 2767 2763 timekeeping_update_from_shadow(tkd, TK_UPDATE_ALL); 2764 + } 2765 + } 2766 + 2767 + static void tk_aux_advance(void) 2768 + { 2769 + unsigned long active = READ_ONCE(aux_timekeepers); 2770 + unsigned int id; 2771 + 2772 + /* Lockless quick check to avoid extra cache lines */ 2773 + for_each_set_bit(id, &active, BITS_PER_LONG) { 2774 + struct tk_data *aux_tkd = &timekeeper_data[id + TIMEKEEPER_AUX_FIRST]; 2775 + 2776 + guard(raw_spinlock)(&aux_tkd->lock); 2777 + if (aux_tkd->shadow_timekeeper.clock_valid) 2778 + __timekeeping_advance(aux_tkd, TK_ADV_TICK); 2768 2779 } 2769 2780 } 2770 2781