[PATCH 18/29] locking, tsx: Abort is mutex_is_locked()

Andi Kleen
2013-03-23T01:27:39Z

Inside a elided mutex we cannot tell if the mutex is really locked
or not. Aborting it he safe answer.

Callers who frequently abort (e.g. BUG_ONs) need to be fixed
separately.

Noop without RTM.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
include/linux/mutex.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index 9121595..0574095 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -14,6 +14,7 @@
#include <linux/spinlock_types.h>
#include <linux/linkage.h>
#include <linux/lockdep.h>
+#include <linux/elide.h>

#include <linux/atomic.h>

@@ -123,6 +124,7 @@ extern void __mutex_init(struct mutex *lock, const char *name,
*/
static inline int mutex_is_locked(struct mutex *lock)
{
+ elide_abort();
return atomic_read(&lock->count) != 1;
}

--
1.7.7.6