]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-generic/mutex-xchg.h
mutex: speed up generic mutex implementations
[linux-2.6-omap-h63xx.git] / include / asm-generic / mutex-xchg.h
index 32a2100c1aebf112639ce9b05e59ca5c182603e0..580a6d35c70078bd91bff6619860b5159b7130b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * asm-generic/mutex-xchg.h
+ * include/asm-generic/mutex-xchg.h
  *
  * Generic implementation of the mutex fastpath, based on xchg().
  *
  * even when the "1" assertion wasn't true.
  */
 static inline void
-__mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
+__mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
 {
        if (unlikely(atomic_xchg(count, 0) != 1))
                fail_fn(count);
-       else
-               smp_mb();
 }
 
 /**
@@ -42,14 +40,11 @@ __mutex_fastpath_lock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
  * or anything the slow path function returns
  */
 static inline int
-__mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *))
+__mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
 {
        if (unlikely(atomic_xchg(count, 0) != 1))
                return fail_fn(count);
-       else {
-               smp_mb();
-               return 0;
-       }
+       return 0;
 }
 
 /**
@@ -65,9 +60,8 @@ __mutex_fastpath_lock_retval(atomic_t *count, fastcall int (*fail_fn)(atomic_t *
  * to return 0 otherwise.
  */
 static inline void
-__mutex_fastpath_unlock(atomic_t *count, fastcall void (*fail_fn)(atomic_t *))
+__mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
 {
-       smp_mb();
        if (unlikely(atomic_xchg(count, 1) != 0))
                fail_fn(count);
 }
@@ -110,7 +104,6 @@ __mutex_fastpath_trylock(atomic_t *count, int (*fail_fn)(atomic_t *))
                if (prev < 0)
                        prev = 0;
        }
-       smp_mb();
 
        return prev;
 }