Loading include/linux/timer.h +2 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,8 @@ extern void add_timer(struct timer_list *timer); extern int try_to_del_timer_sync(struct timer_list *timer); extern struct timer_base timer_base_deferrable; #ifdef CONFIG_SMP extern int del_timer_sync(struct timer_list *timer); #else Loading kernel/time/timer.c +15 −4 Original line number Diff line number Diff line Loading @@ -206,6 +206,7 @@ struct timer_base { } ____cacheline_aligned; static DEFINE_PER_CPU(struct timer_base, timer_bases[NR_BASES]); struct timer_base timer_base_deferrable; #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) unsigned int sysctl_timer_migration = 1; Loading @@ -229,6 +230,9 @@ void timers_update_migration(bool update_nohz) per_cpu(timer_bases[BASE_DEF].nohz_active, cpu) = true; per_cpu(hrtimer_bases.nohz_active, cpu) = true; } timer_base_deferrable.migration_enabled = on; timer_base_deferrable.nohz_active = true; } int timer_migration_handler(struct ctl_table *table, int write, Loading Loading @@ -852,8 +856,11 @@ static inline struct timer_base *get_timer_cpu_base(u32 tflags, u32 cpu) * the deferrable base. */ if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active && (tflags & TIMER_DEFERRABLE)) (tflags & TIMER_DEFERRABLE)) { base = &timer_base_deferrable; if (tflags & TIMER_PINNED) base = per_cpu_ptr(&timer_bases[BASE_DEF], cpu); } return base; } Loading @@ -867,6 +874,8 @@ static inline struct timer_base *get_timer_this_cpu_base(u32 tflags) */ if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active && (tflags & TIMER_DEFERRABLE)) base = &timer_base_deferrable; if (tflags & TIMER_PINNED) base = this_cpu_ptr(&timer_bases[BASE_DEF]); return base; } Loading Loading @@ -1652,9 +1661,11 @@ static __latent_entropy void run_timer_softirq(struct softirq_action *h) struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); __run_timers(base); if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active) if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active) { __run_timers(&timer_base_deferrable); __run_timers(this_cpu_ptr(&timer_bases[BASE_DEF])); } } /* * Called by the local, per-CPU timer interrupt on SMP. Loading Loading
include/linux/timer.h +2 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,8 @@ extern void add_timer(struct timer_list *timer); extern int try_to_del_timer_sync(struct timer_list *timer); extern struct timer_base timer_base_deferrable; #ifdef CONFIG_SMP extern int del_timer_sync(struct timer_list *timer); #else Loading
kernel/time/timer.c +15 −4 Original line number Diff line number Diff line Loading @@ -206,6 +206,7 @@ struct timer_base { } ____cacheline_aligned; static DEFINE_PER_CPU(struct timer_base, timer_bases[NR_BASES]); struct timer_base timer_base_deferrable; #if defined(CONFIG_SMP) && defined(CONFIG_NO_HZ_COMMON) unsigned int sysctl_timer_migration = 1; Loading @@ -229,6 +230,9 @@ void timers_update_migration(bool update_nohz) per_cpu(timer_bases[BASE_DEF].nohz_active, cpu) = true; per_cpu(hrtimer_bases.nohz_active, cpu) = true; } timer_base_deferrable.migration_enabled = on; timer_base_deferrable.nohz_active = true; } int timer_migration_handler(struct ctl_table *table, int write, Loading Loading @@ -852,8 +856,11 @@ static inline struct timer_base *get_timer_cpu_base(u32 tflags, u32 cpu) * the deferrable base. */ if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active && (tflags & TIMER_DEFERRABLE)) (tflags & TIMER_DEFERRABLE)) { base = &timer_base_deferrable; if (tflags & TIMER_PINNED) base = per_cpu_ptr(&timer_bases[BASE_DEF], cpu); } return base; } Loading @@ -867,6 +874,8 @@ static inline struct timer_base *get_timer_this_cpu_base(u32 tflags) */ if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active && (tflags & TIMER_DEFERRABLE)) base = &timer_base_deferrable; if (tflags & TIMER_PINNED) base = this_cpu_ptr(&timer_bases[BASE_DEF]); return base; } Loading Loading @@ -1652,9 +1661,11 @@ static __latent_entropy void run_timer_softirq(struct softirq_action *h) struct timer_base *base = this_cpu_ptr(&timer_bases[BASE_STD]); __run_timers(base); if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active) if (IS_ENABLED(CONFIG_NO_HZ_COMMON) && base->nohz_active) { __run_timers(&timer_base_deferrable); __run_timers(this_cpu_ptr(&timer_bases[BASE_DEF])); } } /* * Called by the local, per-CPU timer interrupt on SMP. Loading