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.

hrtimer: Add bases argument to clock_was_set()

clock_was_set() unconditionaly invokes retrigger_next_event() on all online
CPUs. This was necessary because that mechanism was also used for resume
from suspend to idle which is not longer the case.

The bases arguments allows the callers of clock_was_set() to hand in a mask
which tells clock_was_set() which of the hrtimer clock bases are affected
by the clock setting. This mask will be used in the next step to check
whether a CPU base has timers queued on a clock base affected by the event
and avoid the SMP function call if there are none.

Add a @bases argument, provide defines for the active bases masking and
fixup all callsites.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20210713135158.691083465@linutronix.de

+17 -10
+2 -2
kernel/time/hrtimer.c
··· 880 880 * in the tick, which obviously might be stopped, so this has to bring out 881 881 * the remote CPU which might sleep in idle to get this sorted. 882 882 */ 883 - void clock_was_set(void) 883 + void clock_was_set(unsigned int bases) 884 884 { 885 885 if (!hrtimer_hres_active() && !tick_nohz_active) 886 886 goto out_timerfd; ··· 894 894 895 895 static void clock_was_set_work(struct work_struct *work) 896 896 { 897 - clock_was_set(); 897 + clock_was_set(CLOCK_SET_WALL); 898 898 } 899 899 900 900 static DECLARE_WORK(hrtimer_work, clock_was_set_work);
+8 -1
kernel/time/tick-internal.h
··· 166 166 extern u64 get_next_timer_interrupt(unsigned long basej, u64 basem); 167 167 void timer_clear_idle(void); 168 168 169 - void clock_was_set(void); 169 + #define CLOCK_SET_WALL \ 170 + (BIT(HRTIMER_BASE_REALTIME) | BIT(HRTIMER_BASE_REALTIME_SOFT) | \ 171 + BIT(HRTIMER_BASE_TAI) | BIT(HRTIMER_BASE_TAI_SOFT)) 172 + 173 + #define CLOCK_SET_BOOT \ 174 + (BIT(HRTIMER_BASE_BOOTTIME) | BIT(HRTIMER_BASE_BOOTTIME_SOFT)) 175 + 176 + void clock_was_set(unsigned int bases); 170 177 void clock_was_set_delayed(void); 171 178 172 179 void hrtimers_resume_local(void);
+7 -7
kernel/time/timekeeping.c
··· 1323 1323 write_seqcount_end(&tk_core.seq); 1324 1324 raw_spin_unlock_irqrestore(&timekeeper_lock, flags); 1325 1325 1326 - /* signal hrtimers about time change */ 1327 - clock_was_set(); 1326 + /* Signal hrtimers about time change */ 1327 + clock_was_set(CLOCK_SET_WALL); 1328 1328 1329 1329 if (!ret) 1330 1330 audit_tk_injoffset(ts_delta); ··· 1371 1371 write_seqcount_end(&tk_core.seq); 1372 1372 raw_spin_unlock_irqrestore(&timekeeper_lock, flags); 1373 1373 1374 - /* signal hrtimers about time change */ 1375 - clock_was_set(); 1374 + /* Signal hrtimers about time change */ 1375 + clock_was_set(CLOCK_SET_WALL); 1376 1376 1377 1377 return ret; 1378 1378 } ··· 1746 1746 write_seqcount_end(&tk_core.seq); 1747 1747 raw_spin_unlock_irqrestore(&timekeeper_lock, flags); 1748 1748 1749 - /* signal hrtimers about time change */ 1750 - clock_was_set(); 1749 + /* Signal hrtimers about time change */ 1750 + clock_was_set(CLOCK_SET_WALL | CLOCK_SET_BOOT); 1751 1751 } 1752 1752 #endif 1753 1753 ··· 2440 2440 clock_set |= timekeeping_advance(TK_ADV_FREQ); 2441 2441 2442 2442 if (clock_set) 2443 - clock_was_set(); 2443 + clock_was_set(CLOCK_REALTIME); 2444 2444 2445 2445 ntp_notify_cmos_timer(); 2446 2446