|
|
ce426f |
commit b023e4ca99f5e81f90d87d23cd267ef2abd2388c
|
|
|
ce426f |
Author: Andi Kleen <ak@linux.intel.com>
|
|
|
ce426f |
Date: Sat Dec 22 00:58:34 2012 -0800
|
|
|
ce426f |
|
|
|
ce426f |
Add new internal mutex type flags for elision.
|
|
|
ce426f |
|
|
|
ce426f |
Add Enable/disable flags used internally
|
|
|
ce426f |
|
|
|
ce426f |
Extend the mutex initializers to have the fields needed for
|
|
|
ce426f |
elision. The layout stays the same, and this is not visible
|
|
|
ce426f |
to programs.
|
|
|
ce426f |
|
|
|
ce426f |
These changes are not exposed outside pthread
|
|
|
ce426f |
Index: glibc-2.17-c758a686/nptl/pthreadP.h
|
|
|
ce426f |
===================================================================
|
|
|
ce426f |
--- glibc-2.17-c758a686.orig/nptl/pthreadP.h
|
|
|
ce426f |
+++ glibc-2.17-c758a686/nptl/pthreadP.h
|
|
|
ce426f |
@@ -61,6 +61,10 @@
|
|
|
ce426f |
enum
|
|
|
ce426f |
{
|
|
|
ce426f |
PTHREAD_MUTEX_KIND_MASK_NP = 3,
|
|
|
ce426f |
+
|
|
|
ce426f |
+ PTHREAD_MUTEX_ELISION_NP = 256,
|
|
|
ce426f |
+ PTHREAD_MUTEX_NO_ELISION_NP = 512,
|
|
|
ce426f |
+
|
|
|
ce426f |
PTHREAD_MUTEX_ROBUST_NORMAL_NP = 16,
|
|
|
ce426f |
PTHREAD_MUTEX_ROBUST_RECURSIVE_NP
|
|
|
ce426f |
= PTHREAD_MUTEX_ROBUST_NORMAL_NP | PTHREAD_MUTEX_RECURSIVE_NP,
|
|
|
ce426f |
@@ -93,12 +97,21 @@ enum
|
|
|
ce426f |
PTHREAD_MUTEX_PP_ERRORCHECK_NP
|
|
|
ce426f |
= PTHREAD_MUTEX_PRIO_PROTECT_NP | PTHREAD_MUTEX_ERRORCHECK_NP,
|
|
|
ce426f |
PTHREAD_MUTEX_PP_ADAPTIVE_NP
|
|
|
ce426f |
- = PTHREAD_MUTEX_PRIO_PROTECT_NP | PTHREAD_MUTEX_ADAPTIVE_NP
|
|
|
ce426f |
+ = PTHREAD_MUTEX_PRIO_PROTECT_NP | PTHREAD_MUTEX_ADAPTIVE_NP,
|
|
|
ce426f |
+ PTHREAD_MUTEX_ELISION_FLAGS_NP
|
|
|
ce426f |
+ = PTHREAD_MUTEX_ELISION_NP | PTHREAD_MUTEX_NO_ELISION_NP,
|
|
|
ce426f |
+
|
|
|
ce426f |
+ PTHREAD_MUTEX_TIMED_ELISION_NP =
|
|
|
ce426f |
+ PTHREAD_MUTEX_TIMED_NP | PTHREAD_MUTEX_ELISION_NP,
|
|
|
ce426f |
+ PTHREAD_MUTEX_TIMED_NO_ELISION_NP =
|
|
|
ce426f |
+ PTHREAD_MUTEX_TIMED_NP | PTHREAD_MUTEX_NO_ELISION_NP,
|
|
|
ce426f |
};
|
|
|
ce426f |
#define PTHREAD_MUTEX_PSHARED_BIT 128
|
|
|
ce426f |
|
|
|
ce426f |
#define PTHREAD_MUTEX_TYPE(m) \
|
|
|
ce426f |
((m)->__data.__kind & 127)
|
|
|
ce426f |
+#define PTHREAD_MUTEX_TYPE_ELISION(m) \
|
|
|
ce426f |
+ ((m)->__data.__kind & (127|PTHREAD_MUTEX_ELISION_FLAGS_NP))
|
|
|
ce426f |
|
|
|
ce426f |
#if LLL_PRIVATE == 0 && LLL_SHARED == 128
|
|
|
ce426f |
# define PTHREAD_MUTEX_PSHARED(m) \
|
|
|
ce426f |
Index: glibc-2.17-c758a686/nptl/sysdeps/pthread/pthread.h
|
|
|
ce426f |
===================================================================
|
|
|
ce426f |
--- glibc-2.17-c758a686.orig/nptl/sysdeps/pthread/pthread.h
|
|
|
ce426f |
+++ glibc-2.17-c758a686/nptl/sysdeps/pthread/pthread.h
|
|
|
ce426f |
@@ -83,27 +83,39 @@ enum
|
|
|
ce426f |
|
|
|
ce426f |
|
|
|
ce426f |
/* Mutex initializers. */
|
|
|
ce426f |
+#if __PTHREAD_MUTEX_HAVE_ELISION == 1 /* 64bit layout. */
|
|
|
ce426f |
+#define __PTHREAD_SPINS 0, 0
|
|
|
ce426f |
+#elif __PTHREAD_MUTEX_HAVE_ELISION == 2 /* 32bit layout. */
|
|
|
ce426f |
+#define __PTHREAD_SPINS { 0, 0 }
|
|
|
ce426f |
+#else
|
|
|
ce426f |
+#define __PTHREAD_SPINS 0
|
|
|
ce426f |
+#endif
|
|
|
ce426f |
+
|
|
|
ce426f |
#ifdef __PTHREAD_MUTEX_HAVE_PREV
|
|
|
ce426f |
# define PTHREAD_MUTEX_INITIALIZER \
|
|
|
ce426f |
- { { 0, 0, 0, 0, 0, 0, { 0, 0 } } }
|
|
|
ce426f |
+ { { 0, 0, 0, 0, 0, __PTHREAD_SPINS, { 0, 0 } } }
|
|
|
ce426f |
# ifdef __USE_GNU
|
|
|
ce426f |
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
|
|
|
ce426f |
- { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, { 0, 0 } } }
|
|
|
ce426f |
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, __PTHREAD_SPINS, { 0, 0 } } }
|
|
|
ce426f |
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
|
|
|
ce426f |
- { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, { 0, 0 } } }
|
|
|
ce426f |
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, __PTHREAD_SPINS, { 0, 0 } } }
|
|
|
ce426f |
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
|
|
|
ce426f |
- { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, { 0, 0 } } }
|
|
|
ce426f |
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __PTHREAD_SPINS, { 0, 0 } } }
|
|
|
ce426f |
+# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
|
|
|
ce426f |
+ { { 0, 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, __PTHREAD_SPINS, { 0, 0 } } }
|
|
|
ce426f |
+
|
|
|
ce426f |
# endif
|
|
|
ce426f |
#else
|
|
|
ce426f |
# define PTHREAD_MUTEX_INITIALIZER \
|
|
|
ce426f |
- { { 0, 0, 0, 0, 0, { 0 } } }
|
|
|
ce426f |
+ { { 0, 0, 0, 0, 0, { __PTHREAD_SPINS } } }
|
|
|
ce426f |
# ifdef __USE_GNU
|
|
|
ce426f |
# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \
|
|
|
ce426f |
- { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, { 0 } } }
|
|
|
ce426f |
+ { { 0, 0, 0, PTHREAD_MUTEX_RECURSIVE_NP, 0, { __PTHREAD_SPINS } } }
|
|
|
ce426f |
# define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP \
|
|
|
ce426f |
- { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, { 0 } } }
|
|
|
ce426f |
+ { { 0, 0, 0, PTHREAD_MUTEX_ERRORCHECK_NP, 0, { __PTHREAD_SPINS } } }
|
|
|
ce426f |
# define PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP \
|
|
|
ce426f |
- { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, { 0 } } }
|
|
|
ce426f |
+ { { 0, 0, 0, PTHREAD_MUTEX_ADAPTIVE_NP, 0, { __PTHREAD_SPINS } } }
|
|
|
ce426f |
+
|
|
|
ce426f |
# endif
|
|
|
ce426f |
#endif
|
|
|
ce426f |
|