@@ -205,7 +205,6 @@ struct timer_base {
205
205
unsigned long next_expiry ;
206
206
unsigned int cpu ;
207
207
bool is_idle ;
208
- bool must_forward_clk ;
209
208
DECLARE_BITMAP (pending_map , WHEEL_SIZE );
210
209
struct hlist_head vectors [WHEEL_SIZE ];
211
210
} ____cacheline_aligned ;
@@ -888,12 +887,13 @@ get_target_base(struct timer_base *base, unsigned tflags)
888
887
889
888
static inline void forward_timer_base (struct timer_base * base )
890
889
{
891
- unsigned long jnow ;
890
+ unsigned long jnow = READ_ONCE ( jiffies ) ;
892
891
893
- if (!base -> must_forward_clk )
894
- return ;
895
-
896
- jnow = READ_ONCE (jiffies );
892
+ /*
893
+ * No need to forward if we are close enough below jiffies.
894
+ * Also while executing timers, base->clk is 1 offset ahead
895
+ * of jiffies to avoid endless requeuing to current jffies.
896
+ */
897
897
if ((long )(jnow - base -> clk ) < 2 )
898
898
return ;
899
899
@@ -1722,24 +1722,15 @@ static inline void __run_timers(struct timer_base *base)
1722
1722
timer_base_lock_expiry (base );
1723
1723
raw_spin_lock_irq (& base -> lock );
1724
1724
1725
- /*
1726
- * timer_base::must_forward_clk must be cleared before running
1727
- * timers so that any timer functions that call mod_timer() will
1728
- * not try to forward the base.
1729
- */
1730
- base -> must_forward_clk = false;
1731
-
1732
1725
while (time_after_eq (jiffies , base -> clk ) &&
1733
1726
time_after_eq (jiffies , base -> next_expiry )) {
1734
-
1735
1727
levels = collect_expired_timers (base , heads );
1736
1728
base -> clk ++ ;
1737
1729
base -> next_expiry = __next_timer_interrupt (base );
1738
1730
1739
1731
while (levels -- )
1740
1732
expire_timers (base , heads + levels );
1741
1733
}
1742
- base -> must_forward_clk = true;
1743
1734
raw_spin_unlock_irq (& base -> lock );
1744
1735
timer_base_unlock_expiry (base );
1745
1736
}
@@ -1935,7 +1926,6 @@ int timers_prepare_cpu(unsigned int cpu)
1935
1926
base -> clk = jiffies ;
1936
1927
base -> next_expiry = base -> clk + NEXT_TIMER_MAX_DELTA ;
1937
1928
base -> is_idle = false;
1938
- base -> must_forward_clk = true;
1939
1929
}
1940
1930
return 0 ;
1941
1931
}
0 commit comments