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.

timerfd: Provide timerfd_resume()

Resuming timekeeping is a clock-was-set event and uses the clock-was-set
notification mechanism. This is in the way of making the clock-was-set
update for hrtimers selective so unnecessary IPIs are avoided when a CPU
base does not have timers queued which are affected by the clock setting.

Provide a seperate timerfd_resume() interface so the resume logic and the
clock-was-set mechanism can be distangled in the core code.

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

+18
+16
fs/timerfd.c
··· 115 115 rcu_read_unlock(); 116 116 } 117 117 118 + static void timerfd_resume_work(struct work_struct *work) 119 + { 120 + timerfd_clock_was_set(); 121 + } 122 + 123 + static DECLARE_WORK(timerfd_work, timerfd_resume_work); 124 + 125 + /* 126 + * Invoked from timekeeping_resume(). Defer the actual update to work so 127 + * timerfd_clock_was_set() runs in task context. 128 + */ 129 + void timerfd_resume(void) 130 + { 131 + schedule_work(&timerfd_work); 132 + } 133 + 118 134 static void __timerfd_remove_cancel(struct timerfd_ctx *ctx) 119 135 { 120 136 if (ctx->might_cancel) {
+2
include/linux/hrtimer.h
··· 349 349 350 350 #ifdef CONFIG_TIMERFD 351 351 extern void timerfd_clock_was_set(void); 352 + extern void timerfd_resume(void); 352 353 #else 353 354 static inline void timerfd_clock_was_set(void) { } 355 + static inline void timerfd_resume(void) { } 354 356 #endif 355 357 extern void hrtimers_resume(void); 356 358