Commit 0975fb56 authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Thomas Gleixner

timers: Remove must_forward_clk

There is no reason to keep this guard around. The code makes sure that
base->clk remains sane and won't be forwarded beyond jiffies nor set
backward.
Signed-off-by: default avatarFrederic Weisbecker <frederic@kernel.org>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
Tested-by: default avatarJuri Lelli <juri.lelli@redhat.com>
Link: https://lkml.kernel.org/r/20200717140551.29076-12-frederic@kernel.org
parent d4f7dae8
...@@ -205,7 +205,6 @@ struct timer_base { ...@@ -205,7 +205,6 @@ struct timer_base {
unsigned long next_expiry; unsigned long next_expiry;
unsigned int cpu; unsigned int cpu;
bool is_idle; bool is_idle;
bool must_forward_clk;
DECLARE_BITMAP(pending_map, WHEEL_SIZE); DECLARE_BITMAP(pending_map, WHEEL_SIZE);
struct hlist_head vectors[WHEEL_SIZE]; struct hlist_head vectors[WHEEL_SIZE];
} ____cacheline_aligned; } ____cacheline_aligned;
...@@ -888,12 +887,13 @@ get_target_base(struct timer_base *base, unsigned tflags) ...@@ -888,12 +887,13 @@ get_target_base(struct timer_base *base, unsigned tflags)
static inline void forward_timer_base(struct timer_base *base) static inline void forward_timer_base(struct timer_base *base)
{ {
unsigned long jnow; unsigned long jnow = READ_ONCE(jiffies);
if (!base->must_forward_clk) /*
return; * No need to forward if we are close enough below jiffies.
* Also while executing timers, base->clk is 1 offset ahead
jnow = READ_ONCE(jiffies); * of jiffies to avoid endless requeuing to current jffies.
*/
if ((long)(jnow - base->clk) < 2) if ((long)(jnow - base->clk) < 2)
return; return;
...@@ -1722,16 +1722,8 @@ static inline void __run_timers(struct timer_base *base) ...@@ -1722,16 +1722,8 @@ static inline void __run_timers(struct timer_base *base)
timer_base_lock_expiry(base); timer_base_lock_expiry(base);
raw_spin_lock_irq(&base->lock); raw_spin_lock_irq(&base->lock);
/*
* timer_base::must_forward_clk must be cleared before running
* timers so that any timer functions that call mod_timer() will
* not try to forward the base.
*/
base->must_forward_clk = false;
while (time_after_eq(jiffies, base->clk) && while (time_after_eq(jiffies, base->clk) &&
time_after_eq(jiffies, base->next_expiry)) { time_after_eq(jiffies, base->next_expiry)) {
levels = collect_expired_timers(base, heads); levels = collect_expired_timers(base, heads);
base->clk++; base->clk++;
base->next_expiry = __next_timer_interrupt(base); base->next_expiry = __next_timer_interrupt(base);
...@@ -1739,7 +1731,6 @@ static inline void __run_timers(struct timer_base *base) ...@@ -1739,7 +1731,6 @@ static inline void __run_timers(struct timer_base *base)
while (levels--) while (levels--)
expire_timers(base, heads + levels); expire_timers(base, heads + levels);
} }
base->must_forward_clk = true;
raw_spin_unlock_irq(&base->lock); raw_spin_unlock_irq(&base->lock);
timer_base_unlock_expiry(base); timer_base_unlock_expiry(base);
} }
...@@ -1935,7 +1926,6 @@ int timers_prepare_cpu(unsigned int cpu) ...@@ -1935,7 +1926,6 @@ int timers_prepare_cpu(unsigned int cpu)
base->clk = jiffies; base->clk = jiffies;
base->next_expiry = base->clk + NEXT_TIMER_MAX_DELTA; base->next_expiry = base->clk + NEXT_TIMER_MAX_DELTA;
base->is_idle = false; base->is_idle = false;
base->must_forward_clk = true;
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment