Thread (21 messages) flat view 21 messages, 3 authors, 2012-08-13

RFC: mutex: hung tasks on SMP platforms with asm-generic/mutex-xchg.h

From: Peter Zijlstra <hidden>
Date: 2012-08-13 08:15:24
Also in: lkml

On Thu, 2012-08-09 at 12:57 -0400, Nicolas Pitre wrote:
quoted hunk ↗ jump to hunk
In other words, I think this should look like this:
diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h
index 580a6d35c7..44a66c99c8 100644
--- a/include/asm-generic/mutex-xchg.h
+++ b/include/asm-generic/mutex-xchg.h
@@ -25,8 +25,11 @@
 static inline void
 __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
 {
-       if (unlikely(atomic_xchg(count, 0) != 1))
-               fail_fn(count);
+       if (unlikely(atomic_xchg(count, 0) != 1)) {
+               /* Mark lock contention explicitly */
+               if (likely(atomic_xchg(count, -1) != 1))
+                       fail_fn(count);
+       }
 } 
OK, I like this.. Thanks guys! Will will you send a final and complete
patch?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help