Skip to content

Commit 90d52f6

Browse files
Frederic WeisbeckerKAGA-KOKO
authored andcommitted
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: Frederic Weisbecker <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Juri Lelli <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent dc2a0f1 commit 90d52f6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

kernel/time/timer.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,21 +1706,19 @@ static int collect_expired_timers(struct timer_base *base,
17061706
* the next expiring timer.
17071707
*/
17081708
if ((long)(now - base->clk) > 2) {
1709-
unsigned long next = __next_timer_interrupt(base);
1710-
17111709
/*
17121710
* If the next timer is ahead of time forward to current
17131711
* jiffies, otherwise forward to the next expiry time:
17141712
*/
1715-
if (time_after(next, now)) {
1713+
if (time_after(base->next_expiry, now)) {
17161714
/*
17171715
* The call site will increment base->clk and then
17181716
* terminate the expiry loop immediately.
17191717
*/
17201718
base->clk = now;
17211719
return 0;
17221720
}
1723-
base->clk = next;
1721+
base->clk = base->next_expiry;
17241722
}
17251723
return __collect_expired_timers(base, heads);
17261724
}

0 commit comments

Comments
 (0)