lkml.org 
[lkml]   [2009]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[tip:timers/urgent] hrtimer: migration: do not check expiry time on current CPU
Commit-ID:  de907e8432b08f2d5966c36e0747e97c0e596810
Gitweb: http://git.kernel.org/tip/de907e8432b08f2d5966c36e0747e97c0e596810
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Thu, 9 Jul 2009 13:52:32 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 9 Jul 2009 13:59:11 +0200

hrtimer: migration: do not check expiry time on current CPU

The timer migration code needs to check whether the expiry time of the
timer is before the programmed clock event expiry time when the timer
is enqueued on another CPU because we can not reprogram the timer
device on the other CPU. The current logic checks the expiry time even
if we enqueue on the current CPU when nohz_get_load_balancer() returns
current CPU. This might lead to an endless loop in the expiry check
code when the expiry time of the timer is before the current
programmed next event.

Check whether nohz_get_load_balancer() returns current CPU and skip
the expiry check if this is the case.

Cc: Arun Bharadwaj <arun@linux.vnet.ibm.com
LKML-Reference: <new-submission>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>


---
kernel/hrtimer.c | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index 0d43451..d171ecf 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -206,8 +206,19 @@ switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base,
#if defined(CONFIG_NO_HZ) && defined(CONFIG_SMP)
if (!pinned && get_sysctl_timer_migration() && idle_cpu(cpu)) {
preferred_cpu = get_nohz_load_balancer();
- if (preferred_cpu >= 0)
- cpu = preferred_cpu;
+ if (preferred_cpu >= 0) {
+ /*
+ * We must not check the expiry value when
+ * preferred_cpu is the current cpu. If base
+ * != new_base we would loop forever when the
+ * timer expires before the current programmed
+ * next timer event.
+ */
+ if (preferred_cpu != cpu)
+ cpu = preferred_cpu;
+ else
+ preferred_cpu = -1;
+ }
}
#endif


\
 
 \ /
  Last update: 2009-07-09 14:07    [W:0.027 / U:3.588 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site