diff options
author | Peter Zijlstra <peterz@infradead.org> | 2020-07-22 10:22:02 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2020-07-22 10:22:02 +0200 |
commit | 015dc08918785201199ed3450c22bb8939f09dfe (patch) | |
tree | 7ba52e0b1e518fa750aaac0c1da8dd70c3eca1eb /kernel/time | |
parent | sched: Add a tracepoint to track rq->nr_running (diff) | |
parent | sched: Fix race against ptrace_freeze_trace() (diff) | |
download | linux-015dc08918785201199ed3450c22bb8939f09dfe.tar.xz linux-015dc08918785201199ed3450c22bb8939f09dfe.zip |
Merge branch 'sched/urgent'
Diffstat (limited to 'kernel/time')
-rw-r--r-- | kernel/time/timer.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/kernel/time/timer.c b/kernel/time/timer.c index 398e6eadb861..df1ff803acc4 100644 --- a/kernel/time/timer.c +++ b/kernel/time/timer.c @@ -521,8 +521,8 @@ static int calc_wheel_index(unsigned long expires, unsigned long clk) * Force expire obscene large timeouts to expire at the * capacity limit of the wheel. */ - if (expires >= WHEEL_TIMEOUT_CUTOFF) - expires = WHEEL_TIMEOUT_MAX; + if (delta >= WHEEL_TIMEOUT_CUTOFF) + expires = clk + WHEEL_TIMEOUT_MAX; idx = calc_index(expires, LVL_DEPTH - 1); } @@ -584,7 +584,15 @@ trigger_dyntick_cpu(struct timer_base *base, struct timer_list *timer) * Set the next expiry time and kick the CPU so it can reevaluate the * wheel: */ - base->next_expiry = timer->expires; + if (time_before(timer->expires, base->clk)) { + /* + * Prevent from forward_timer_base() moving the base->clk + * backward + */ + base->next_expiry = base->clk; + } else { + base->next_expiry = timer->expires; + } wake_up_nohz_cpu(base->cpu); } @@ -896,10 +904,13 @@ static inline void forward_timer_base(struct timer_base *base) * If the next expiry value is > jiffies, then we fast forward to * jiffies otherwise we forward to the next expiry value. */ - if (time_after(base->next_expiry, jnow)) + if (time_after(base->next_expiry, jnow)) { base->clk = jnow; - else + } else { + if (WARN_ON_ONCE(time_before(base->next_expiry, base->clk))) + return; base->clk = base->next_expiry; + } #endif } |