summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-02-07 21:58:54 +0100
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-08 01:12:33 +0100
commite0a602963485a2f109ae1521c0c55507304c63ed (patch)
tree38900590f1d4f129cfd8748949ff62f7d3296aee
parent[PATCH] mm: compound release fix (diff)
downloadlinux-e0a602963485a2f109ae1521c0c55507304c63ed.tar.xz
linux-e0a602963485a2f109ae1521c0c55507304c63ed.zip
[PATCH] Fix spinlock debugging delays to not time out too early
The spinlock-debug wait-loop was using loops_per_jiffy to detect too long spinlock waits - but on fast CPUs this led to a way too fast timeout and false messages. The fix is to include a __delay(1) call in the loop, to correctly approximate the intended delay timeout of 1 second. The code assumes that every architecture implements __delay(1) to last around 1/(loops_per_jiffy*HZ) seconds. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: Andi Kleen <ak@muc.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--lib/spinlock_debug.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/spinlock_debug.c b/lib/spinlock_debug.c
index c8bb8cc899d7..d8b6bb419d49 100644
--- a/lib/spinlock_debug.c
+++ b/lib/spinlock_debug.c
@@ -72,9 +72,9 @@ static void __spin_lock_debug(spinlock_t *lock)
for (;;) {
for (i = 0; i < loops_per_jiffy * HZ; i++) {
- cpu_relax();
if (__raw_spin_trylock(&lock->raw_lock))
return;
+ __delay(1);
}
/* lockup suspected: */
if (print_once) {
@@ -144,9 +144,9 @@ static void __read_lock_debug(rwlock_t *lock)
for (;;) {
for (i = 0; i < loops_per_jiffy * HZ; i++) {
- cpu_relax();
if (__raw_read_trylock(&lock->raw_lock))
return;
+ __delay(1);
}
/* lockup suspected: */
if (print_once) {
@@ -217,9 +217,9 @@ static void __write_lock_debug(rwlock_t *lock)
for (;;) {
for (i = 0; i < loops_per_jiffy * HZ; i++) {
- cpu_relax();
if (__raw_write_trylock(&lock->raw_lock))
return;
+ __delay(1);
}
/* lockup suspected: */
if (print_once) {