[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1364001923-10796-13-git-send-email-andi@firstfloor.org>
Date: Fri, 22 Mar 2013 18:25:06 -0700
From: Andi Kleen <andi@...stfloor.org>
To: linux-kernel@...r.kernel.org
Cc: torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
x86@...nel.org, Andi Kleen <ak@...ux.intel.com>
Subject: [PATCH 12/29] x86, tsx: Add a per thread transaction disable count
From: Andi Kleen <ak@...ux.intel.com>
For some locks that have a low chance of not aborting it's
best to just disable transactions.
Add a counter to thread_info to allow to disable tranasctions
for the current task.
I originally experimented with more complicated solutions,
like a magic spinlock type to disable with magic type matching,
but that was very intrusive in the locking code.
This setup -- while adding a few more instructions -- is more
flexible and seems to work quite nicely.
Signed-off-by: Andi Kleen <ak@...ux.intel.com>
---
arch/x86/include/asm/thread_info.h | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 2cd056e..91bb84e 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -39,6 +39,7 @@ struct thread_info {
*/
__u8 supervisor_stack[0];
#endif
+ unsigned notxn; /* transactions are disabled */
unsigned int sig_on_uaccess_error:1;
unsigned int uaccess_err:1; /* uaccess failed */
};
@@ -279,6 +280,13 @@ static inline bool is_ia32_task(void)
#endif
return false;
}
+
+#ifdef CONFIG_RTM_LOCKS
+#define txn_disabled() (current_thread_info()->notxn)
+#define disable_txn() (current_thread_info()->notxn++)
+#define reenable_txn() (current_thread_info()->notxn--)
+#endif
+
#endif /* !__ASSEMBLY__ */
#ifndef __ASSEMBLY__
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists