[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-de907e8432b08f2d5966c36e0747e97c0e596810@git.kernel.org>
Date: Thu, 9 Jul 2009 12:04:21 GMT
From: tip-bot for Thomas Gleixner <tglx@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
tglx@...utronix.de
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@...utronix.de>
AuthorDate: Thu, 9 Jul 2009 13:52:32 +0200
Committer: Thomas Gleixner <tglx@...utronix.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@...ux.vnet.ibm.com
LKML-Reference: <new-submission>
Signed-off-by: Thomas Gleixner <tglx@...utronix.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists