summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLeon Ma <xindong.ma@intel.com>2014-04-30 16:43:10 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-06-07 16:02:01 -0700
commita91ccfcaaaa358eba4579965d9a85dbb756c2596 (patch)
treec7232861d3241f50f6726b949419b3fba8e5ae87 /kernel
parent3d8b2f5e4007d4b28ac760e1aa72e91f4021ea90 (diff)
downloadlinux-stable-a91ccfcaaaa358eba4579965d9a85dbb756c2596.tar.gz
linux-stable-a91ccfcaaaa358eba4579965d9a85dbb756c2596.tar.bz2
linux-stable-a91ccfcaaaa358eba4579965d9a85dbb756c2596.zip
hrtimer: Prevent remote enqueue of leftmost timers
commit 012a45e3f4af68e86d85cce060c6c2fed56498b2 upstream. If a cpu is idle and starts an hrtimer which is not pinned on that same cpu, the nohz code might target the timer to a different cpu. In the case that we switch the cpu base of the timer we already have a sanity check in place, which determines whether the timer is earlier than the current leftmost timer on the target cpu. In that case we enqueue the timer on the current cpu because we cannot reprogram the clock event device on the target. If the timers base is already the target CPU we do not have this sanity check in place so we enqueue the timer as the leftmost timer in the target cpus rb tree, but we cannot reprogram the clock event device on the target cpu. So the timer expires late and subsequently prevents the reprogramming of the target cpu clock event device until the previously programmed event fires or a timer with an earlier expiry time gets enqueued on the target cpu itself. Add the same target check as we have for the switch base case and start the timer on the current cpu if it would become the leftmost timer on the target. [ tglx: Rewrote subject and changelog ] Signed-off-by: Leon Ma <xindong.ma@intel.com> Link: http://lkml.kernel.org/r/1398847391-5994-1-git-send-email-xindong.ma@intel.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/hrtimer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 742788d827b8..492828da45ee 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -232,6 +232,11 @@ again:
goto again;
}
timer->base = new_base;
+ } else {
+ if (cpu != this_cpu && hrtimer_check_target(timer, new_base)) {
+ cpu = this_cpu;
+ goto again;
+ }
}
return new_base;
}