diff options
author | Olof Johansson <olof@lixom.net> | 2012-09-16 18:50:30 -0700 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2012-09-16 18:50:30 -0700 |
commit | d192f93cfca6a0aedbf10fa548d8bc17b86275d6 (patch) | |
tree | 357a4106ec49747bd78550a79d68f7b6d1f642a3 /include/asm-generic/mutex-xchg.h | |
parent | adcb079f28ec08165897e2450a4a60b219274008 (diff) | |
parent | d5703bd35a4c76b0717ea51e2e8aabce341828a1 (diff) |
Merge tag 'tegra-for-3.7-maintainers' of git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra into next/maintainers
* tag 'tegra-for-3.7-maintainers' of git://git.kernel.org/pub/scm/linux/kernel/git/swarren/linux-tegra:
MAINTAINERS: tegra: remove Olof/Colin, add device tree files
MAINTAINERS: add defconfig file to TEGRA section
+ sync with 3.6-rc4
Diffstat (limited to 'include/asm-generic/mutex-xchg.h')
-rw-r--r-- | include/asm-generic/mutex-xchg.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/asm-generic/mutex-xchg.h b/include/asm-generic/mutex-xchg.h index 580a6d35c70..c04e0db8a2d 100644 --- a/include/asm-generic/mutex-xchg.h +++ b/include/asm-generic/mutex-xchg.h @@ -26,7 +26,13 @@ static inline void __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *)) { if (unlikely(atomic_xchg(count, 0) != 1)) - fail_fn(count); + /* + * We failed to acquire the lock, so mark it contended + * to ensure that any waiting tasks are woken up by the + * unlock slow path. + */ + if (likely(atomic_xchg(count, -1) != 1)) + fail_fn(count); } /** @@ -43,7 +49,8 @@ static inline int __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *)) { if (unlikely(atomic_xchg(count, 0) != 1)) - return fail_fn(count); + if (likely(atomic_xchg(count, -1) != 1)) + return fail_fn(count); return 0; } |