@@ -635,11 +635,16 @@ trigger_dyntick_cpu(struct timer_base *base, struct timer_list *timer)
635
635
636
636
/*
637
637
* We might have to IPI the remote CPU if the base is idle and the
638
- * timer is not deferrable. If the other CPU is on the way to idle
639
- * then it can't set base->is_idle as we hold the base lock:
638
+ * timer is pinned. If it is a non pinned timer, it is only queued
639
+ * on the remote CPU, when timer was running during queueing. Then
640
+ * everything is handled by remote CPU anyway. If the other CPU is
641
+ * on the way to idle then it can't set base->is_idle as we hold
642
+ * the base lock:
640
643
*/
641
- if (base -> is_idle )
644
+ if (base -> is_idle ) {
645
+ WARN_ON_ONCE (!(timer -> flags & TIMER_PINNED ));
642
646
wake_up_nohz_cpu (base -> cpu );
647
+ }
643
648
}
644
649
645
650
/*
@@ -986,17 +991,6 @@ static inline struct timer_base *get_timer_base(u32 tflags)
986
991
return get_timer_cpu_base (tflags , tflags & TIMER_CPUMASK );
987
992
}
988
993
989
- static inline struct timer_base *
990
- get_target_base (struct timer_base * base , unsigned tflags )
991
- {
992
- #if defined(CONFIG_SMP ) && defined(CONFIG_NO_HZ_COMMON )
993
- if (static_branch_likely (& timers_migration_enabled ) &&
994
- !(tflags & TIMER_PINNED ))
995
- return get_timer_cpu_base (tflags , get_nohz_timer_target ());
996
- #endif
997
- return get_timer_this_cpu_base (tflags );
998
- }
999
-
1000
994
static inline void __forward_timer_base (struct timer_base * base ,
1001
995
unsigned long basej )
1002
996
{
@@ -1151,7 +1145,7 @@ __mod_timer(struct timer_list *timer, unsigned long expires, unsigned int option
1151
1145
if (!ret && (options & MOD_TIMER_PENDING_ONLY ))
1152
1146
goto out_unlock ;
1153
1147
1154
- new_base = get_target_base ( base , timer -> flags );
1148
+ new_base = get_timer_this_cpu_base ( timer -> flags );
1155
1149
1156
1150
if (base != new_base ) {
1157
1151
/*
@@ -2297,7 +2291,7 @@ static inline u64 __get_next_timer_interrupt(unsigned long basej, u64 basem,
2297
2291
* granularity skew (by design).
2298
2292
*/
2299
2293
if (!base_local -> is_idle && time_after (nextevt , basej + 1 )) {
2300
- base_local -> is_idle = base_global -> is_idle = true;
2294
+ base_local -> is_idle = true;
2301
2295
trace_timer_base_idle (true, base_local -> cpu );
2302
2296
}
2303
2297
* idle = base_local -> is_idle ;
@@ -2363,13 +2357,13 @@ u64 timer_base_try_to_set_idle(unsigned long basej, u64 basem, bool *idle)
2363
2357
void timer_clear_idle (void )
2364
2358
{
2365
2359
/*
2366
- * We do this unlocked. The worst outcome is a remote enqueue sending
2367
- * a pointless IPI, but taking the lock would just make the window for
2368
- * sending the IPI a few instructions smaller for the cost of taking
2369
- * the lock in the exit from idle path.
2360
+ * We do this unlocked. The worst outcome is a remote pinned timer
2361
+ * enqueue sending a pointless IPI, but taking the lock would just
2362
+ * make the window for sending the IPI a few instructions smaller
2363
+ * for the cost of taking the lock in the exit from idle
2364
+ * path. Required for BASE_LOCAL only.
2370
2365
*/
2371
2366
__this_cpu_write (timer_bases [BASE_LOCAL ].is_idle , false);
2372
- __this_cpu_write (timer_bases [BASE_GLOBAL ].is_idle , false);
2373
2367
trace_timer_base_idle (false, smp_processor_id ());
2374
2368
2375
2369
/* Activate without holding the timer_base->lock */
0 commit comments