summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-09-26 15:53:17 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2019-09-26 15:53:17 -0700
commitda05b5ea12c1e50b2988a63470d6b69434796f8b (patch)
tree00311ffae4f9df37695ab8e285232d9b465b81bf /kernel
parenta7b7b772bb4abaa4b2d9df67b50bf7208203da82 (diff)
parente430d802d6a3aaf61bd3ed03d9404888a29b9bf9 (diff)
downloadlinux-stable-da05b5ea12c1e50b2988a63470d6b69434796f8b.tar.gz
linux-stable-da05b5ea12c1e50b2988a63470d6b69434796f8b.tar.bz2
linux-stable-da05b5ea12c1e50b2988a63470d6b69434796f8b.zip
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fix from Ingo Molnar: "Fix a timer expiry bug that would cause spurious delay of timers" * 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: timer: Read jiffies once when forwarding base clk
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/timer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 0e315a2e77ae..4820823515e9 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1678,24 +1678,26 @@ void timer_clear_idle(void)
static int collect_expired_timers(struct timer_base *base,
struct hlist_head *heads)
{
+ unsigned long now = READ_ONCE(jiffies);
+
/*
* NOHZ optimization. After a long idle sleep we need to forward the
* base to current jiffies. Avoid a loop by searching the bitfield for
* the next expiring timer.
*/
- if ((long)(jiffies - 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
* jiffies, otherwise forward to the next expiry time:
*/
- if (time_after(next, jiffies)) {
+ if (time_after(next, now)) {
/*
* The call site will increment base->clk and then
* terminate the expiry loop immediately.
*/
- base->clk = jiffies;
+ base->clk = now;
return 0;
}
base->clk = next;