Commit 90d52f65 authored by Frederic Weisbecker's avatar Frederic Weisbecker Committed by Thomas Gleixner

timers: Reuse next expiry cache after nohz exit

Now that the next expiry it tracked unconditionally when a timer is added,
this information can be reused on a tick firing after exiting nohz.
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-9-frederic@kernel.org
parent dc2a0f1f
...@@ -1706,13 +1706,11 @@ static int collect_expired_timers(struct timer_base *base, ...@@ -1706,13 +1706,11 @@ static int collect_expired_timers(struct timer_base *base,
* the next expiring timer. * the next expiring timer.
*/ */
if ((long)(now - base->clk) > 2) { if ((long)(now - base->clk) > 2) {
unsigned long next = __next_timer_interrupt(base);
/* /*
* If the next timer is ahead of time forward to current * If the next timer is ahead of time forward to current
* jiffies, otherwise forward to the next expiry time: * jiffies, otherwise forward to the next expiry time:
*/ */
if (time_after(next, now)) { if (time_after(base->next_expiry, now)) {
/* /*
* The call site will increment base->clk and then * The call site will increment base->clk and then
* terminate the expiry loop immediately. * terminate the expiry loop immediately.
...@@ -1720,7 +1718,7 @@ static int collect_expired_timers(struct timer_base *base, ...@@ -1720,7 +1718,7 @@ static int collect_expired_timers(struct timer_base *base,
base->clk = now; base->clk = now;
return 0; return 0;
} }
base->clk = next; base->clk = base->next_expiry;
} }
return __collect_expired_timers(base, heads); return __collect_expired_timers(base, heads);
} }
......
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