about summary refs log tree commit diff
path: root/nptl/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps')
-rw-r--r--nptl/sysdeps/i386/tls.h6
-rw-r--r--nptl/sysdeps/ia64/tls.h4
-rw-r--r--nptl/sysdeps/powerpc/tls.h4
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_timedwait.c2
-rw-r--r--nptl/sysdeps/pthread/pthread_cond_wait.c2
-rw-r--r--nptl/sysdeps/s390/tls.h4
-rw-r--r--nptl/sysdeps/sh/tls.h7
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S19
-rw-r--r--nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S19
-rw-r--r--nptl/sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c1
-rw-r--r--nptl/sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h8
-rw-r--r--nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S3
-rw-r--r--nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S3
-rw-r--r--nptl/sysdeps/x86_64/tls.h4
19 files changed, 46 insertions, 60 deletions
diff --git a/nptl/sysdeps/i386/tls.h b/nptl/sysdeps/i386/tls.h
index e0fc9ee284..85d6473380 100644
--- a/nptl/sysdeps/i386/tls.h
+++ b/nptl/sysdeps/i386/tls.h
@@ -248,13 +248,9 @@ union user_desc_init
 # define THREAD_SELF \
   ({ struct pthread *__self;						      \
      asm ("movl %%gs:%c1,%0" : "=r" (__self)				      \
-	  : "i" (offsetof (struct pthread, header.self)));			      \
+	  : "i" (offsetof (struct pthread, header.self)));		      \
      __self;})
 
-/* Identifier for the current thread.  THREAD_SELF is usable but
-   sometimes more expensive than necessary.  It is fine here.  */
-# define THREAD_ID THREAD_SELF
-
 
 /* Read member of the thread descriptor directly.  */
 # define THREAD_GETMEM(descr, member) \
diff --git a/nptl/sysdeps/ia64/tls.h b/nptl/sysdeps/ia64/tls.h
index 5ce74737a7..8a13a59d30 100644
--- a/nptl/sysdeps/ia64/tls.h
+++ b/nptl/sysdeps/ia64/tls.h
@@ -113,10 +113,6 @@ register struct pthread *__thread_self __asm__("r13");
 /* Return the thread descriptor for the current thread.  */
 # define THREAD_SELF (__thread_self - 1)
 
-/* Identifier for the current thread.  THREAD_SELF is usable but
-   sometimes more expensive than necessary as in this case.  */
-# define THREAD_ID __thread_self
-
 /* Access to data in the thread descriptor is easy.  */
 #define THREAD_GETMEM(descr, member) \
   descr->member
diff --git a/nptl/sysdeps/powerpc/tls.h b/nptl/sysdeps/powerpc/tls.h
index 70aff09e24..6573bb6b04 100644
--- a/nptl/sysdeps/powerpc/tls.h
+++ b/nptl/sysdeps/powerpc/tls.h
@@ -129,10 +129,6 @@ register void *__thread_register __asm__ ("r13");
     ((struct pthread *) (__thread_register \
 			 - TLS_TCB_OFFSET - TLS_PRE_TCB_SIZE))
 
-/* Identifier for the current thread.  THREAD_SELF is usable but
-   sometimes more expensive than necessary as in this case.  */
-# define THREAD_ID __thread_register
-
 /* Read member of the thread descriptor directly.  */
 # define THREAD_GETMEM(descr, member) ((void)(descr), (THREAD_SELF)->member)
 
diff --git a/nptl/sysdeps/pthread/pthread_cond_timedwait.c b/nptl/sysdeps/pthread/pthread_cond_timedwait.c
index 4dd6f2e02a..7f7d2086f2 100644
--- a/nptl/sysdeps/pthread/pthread_cond_timedwait.c
+++ b/nptl/sysdeps/pthread/pthread_cond_timedwait.c
@@ -56,7 +56,7 @@ __pthread_cond_timedwait (cond, mutex, abstime)
   lll_mutex_lock (cond->__data.__lock);
 
   /* Now we can release the mutex.  */
-  int err = __pthread_mutex_unlock_internal (mutex);
+  int err = __pthread_mutex_unlock_usercnt (mutex, 0);
   if (err)
     {
       lll_mutex_unlock (cond->__data.__lock);
diff --git a/nptl/sysdeps/pthread/pthread_cond_wait.c b/nptl/sysdeps/pthread/pthread_cond_wait.c
index da94cc2d6b..75edf3d158 100644
--- a/nptl/sysdeps/pthread/pthread_cond_wait.c
+++ b/nptl/sysdeps/pthread/pthread_cond_wait.c
@@ -82,7 +82,7 @@ __pthread_cond_wait (cond, mutex)
   lll_mutex_lock (cond->__data.__lock);
 
   /* Now we can release the mutex.  */
-  err = __pthread_mutex_unlock_internal (mutex);
+  err = __pthread_mutex_unlock_usercnt (mutex, 0);
   if (err)
     {
       lll_mutex_unlock (cond->__data.__lock);
diff --git a/nptl/sysdeps/s390/tls.h b/nptl/sysdeps/s390/tls.h
index 89e51ff228..06237ae15b 100644
--- a/nptl/sysdeps/s390/tls.h
+++ b/nptl/sysdeps/s390/tls.h
@@ -137,10 +137,6 @@ typedef struct
 /* Return the thread descriptor for the current thread.  */
 # define THREAD_SELF ((struct pthread *) __builtin_thread_pointer ())
 
-/* Identifier for the current thread.  THREAD_SELF is usable but
-   sometimes more expensive than necessary.  It is fine here.  */
-# define THREAD_ID THREAD_SELF
-
 /* Access to data in the thread descriptor is easy.  */
 #define THREAD_GETMEM(descr, member) \
   descr->member
diff --git a/nptl/sysdeps/sh/tls.h b/nptl/sysdeps/sh/tls.h
index a6cefa0b31..1e27b987e0 100644
--- a/nptl/sysdeps/sh/tls.h
+++ b/nptl/sysdeps/sh/tls.h
@@ -117,13 +117,6 @@ typedef struct
      __asm ("stc gbr,%0" : "=r" (__self));				      \
      __self - 1;})
 
-/* Identifier for the current thread.  THREAD_SELF is usable but
-   sometimes more expensive than necessary as in this case.  */
-# define THREAD_ID \
-  ({ struct pthread *__self;						      \
-     __asm ("stc gbr,%0" : "=r" (__self));				      \
-     __self;})
-
 /* Read member of the thread descriptor directly.  */
 # define THREAD_GETMEM(descr, member) (descr->member)
 
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h
index 256589da0d..a098106629 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/i386/bits/pthreadtypes.h
@@ -51,10 +51,11 @@ typedef union
   {
     int __lock;
     unsigned int __count;
-    struct pthread *__owner;
+    int __owner;
     /* KIND must stay at this position in the structure to maintain
        binary compatibility.  */
     int __kind;
+    unsigned int __nusers;
   } __data;
   char __size[__SIZEOF_PTHREAD_MUTEX_T];
   long int __align;
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
index 5eec268b29..2f598980e5 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
@@ -72,9 +72,8 @@ __pthread_cond_timedwait:
 	movl	%eax, dep_mutex(%ebx)
 
 	/* Unlock the mutex.  */
-	pushl	%eax
-.Lpush4:
-	call	__pthread_mutex_unlock_internal
+	xorl	%edx, %edx
+	call	__pthread_mutex_unlock_usercnt
 
 	testl	%eax, %eax
 	jne	16f
@@ -90,7 +89,7 @@ __pthread_cond_timedwait:
 #else
 	leal	__condvar_cleanup, %eax
 #endif
-	subl	$40, %esp
+	subl	$44, %esp
 .Lsubl:
 	leal	28(%esp), %edx
 	movl	%esp, 8(%esp)
@@ -299,15 +298,15 @@ __pthread_cond_timedwait:
 	/* The initial unlocking of the mutex failed.  */
 16:
 .LSbl3:
-	movl	%eax, (%esp)
 	LOCK
 #if cond_lock == 0
 	subl	$1, (%ebx)
 #else
 	subl	$1, cond_lock(%ebx)
 #endif
-	jne	17f
+	jne	18b
 
+	movl	%eax, %esi
 #if cond_lock == 0
 	movl	%ebx, %eax
 #else
@@ -315,7 +314,7 @@ __pthread_cond_timedwait:
 #endif
 	call	__lll_mutex_unlock_wake
 
-17:	popl	%eax
+	movl	%esi, %eax
 	jmp	18b
 
 #if defined __NR_clock_gettime && !defined __ASSUME_POSIX_TIMERS
@@ -411,10 +410,8 @@ versioned_symbol (libpthread, __pthread_cond_timedwait, pthread_cond_timedwait,
 	.uleb128 20
 	.byte	0x83				# DW_CFA_offset %ebx
 	.uleb128 5
-	.byte	0x40+.Lpush4-.Lpush_ebx		# DW_CFA_advance_loc+N
-	.byte	14				# DW_CFA_def_cfa_offset
-	.uleb128 24
-	.byte	0x40+.Lsubl-.Lpush4		# DW_CFA_advance_loc+N
+	.byte	2				# DW_CFA_advance_loc1
+	.byte	.Lsubl-.Lpush_ebx
 	.byte	14				# DW_CFA_def_cfa_offset
 	.uleb128 64
 	.byte	3				# DW_CFA_advance_loc2
diff --git a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
index 61d3d8d225..c98899ab05 100644
--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S
@@ -127,9 +127,8 @@ __pthread_cond_wait:
 	movl	%eax, dep_mutex(%ebx)
 
 	/* Unlock the mutex.  */
-	pushl	%eax
-.Lpush4:
-	call	__pthread_mutex_unlock_internal
+	xorl	%edx, %edx
+	call	__pthread_mutex_unlock_usercnt
 
 	testl	%eax, %eax
 	jne	12f
@@ -145,7 +144,7 @@ __pthread_cond_wait:
 #else
 	leal	__condvar_cleanup, %eax
 #endif
-	subl	$32, %esp
+	subl	$36, %esp
 .Lsubl:
 	leal	20(%esp), %edx
 	movl	%esp, 8(%esp)
@@ -289,15 +288,15 @@ __pthread_cond_wait:
 	/* The initial unlocking of the mutex failed.  */
 12:
 .LSbl3:
-	movl	%eax, (%esp)
 	LOCK
 #if cond_lock == 0
 	subl	$1, (%ebx)
 #else
 	subl	$1, cond_lock(%ebx)
 #endif
-	jne	13f
+	jne	14b
 
+	movl	%eax, %esi
 #if cond_lock == 0
 	movl	%ebx, %eax
 #else
@@ -305,7 +304,7 @@ __pthread_cond_wait:
 #endif
 	call	__lll_mutex_unlock_wake
 
-13:	popl	%eax
+	movl	%esi, %eax
 	jmp	14b
 .LENDCODE:
 	.size	__pthread_cond_wait, .-__pthread_cond_wait
@@ -371,10 +370,8 @@ versioned_symbol (libpthread, __pthread_cond_wait, pthread_cond_wait,
 	.uleb128 16
 	.byte	0x83				# DW_CFA_offset %ebx
 	.uleb128 4
-	.byte	0x40+.Lpush4-.Lpush_ebx		# DW_CFA_advance_loc+N
-	.byte	14				# DW_CFA_def_cfa_offset
-	.uleb128 20
-	.byte	0x40+.Lsubl-.Lpush4		# DW_CFA_advance_loc+N
+	.byte	2				# DW_CFA_advance_loc1
+	.byte	.Lsubl-.Lpush_ebx
 	.byte	14				# DW_CFA_def_cfa_offset
 	.uleb128 52
 	.byte	2				# DW_CFA_advance_loc1
diff --git a/nptl/sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h
index afd2f31465..c1eca62be7 100644
--- a/nptl/sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/ia64/bits/pthreadtypes.h
@@ -51,7 +51,8 @@ typedef union
   {
     int __lock;
     unsigned int __count;
-    struct pthread *__owner;
+    int __owner;
+    unsigned int __nusers;
     /* KIND must stay at this position in the structure to maintain
        binary compatibility.  */
     int __kind;
diff --git a/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
index 8f3e64d75b..f827b3098d 100644
--- a/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h
@@ -66,10 +66,16 @@ typedef union
   {
     int __lock;
     unsigned int __count;
-    struct pthread *__owner;
+    int __owner;
+#if __WORDSIZE == 64
+    unsigned int __nusers;
+#endif
     /* KIND must stay at this position in the structure to maintain
        binary compatibility.  */
     int __kind;
+#if __WORDSIZE != 64
+    unsigned int __nusers;
+#endif
   } __data;
   char __size[__SIZEOF_PTHREAD_MUTEX_T];
   long int __align;
diff --git a/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c b/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c
index 893a5e932d..d253c72ea4 100644
--- a/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c
+++ b/nptl/sysdeps/unix/sysv/linux/pthread_mutex_cond_lock.c
@@ -2,5 +2,6 @@
 
 #define LLL_MUTEX_LOCK(mutex) lll_mutex_cond_lock(mutex)
 #define __pthread_mutex_lock __pthread_mutex_cond_lock
+#define NO_INCR
 
 #include <nptl/pthread_mutex_lock.c>
diff --git a/nptl/sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h
index e34875f996..2d37683ee2 100644
--- a/nptl/sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/s390/bits/pthreadtypes.h
@@ -65,10 +65,16 @@ typedef union
   {
     int __lock;
     unsigned int __count;
-    struct pthread *__owner;
+    int __owner;
+#if __WORDSIZE == 64
+    unsigned int __nusers;
+#endif
     /* KIND must stay at this position in the structure to maintain
        binary compatibility.  */
     int __kind;
+#if __WORDSIZE != 64
+    unsigned int __nusers;
+#endif
   } __data;
   char __size[__SIZEOF_PTHREAD_MUTEX_T];
   long int __align;
diff --git a/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
index 1eeae708e1..8236fd724a 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/sh/bits/pthreadtypes.h
@@ -52,10 +52,11 @@ typedef union
   {
     int __lock;
     unsigned int __count;
-    struct pthread *__owner;
+    int __owner;
     /* KIND must stay at this position in the structure to maintain
        binary compatibility.  */
     int __kind;
+    unsigned int __nusers;
   } __data;
   char __size[__SIZEOF_PTHREAD_MUTEX_T];
   long int __align;
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h
index b2919ab4c6..ed3050e636 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/bits/pthreadtypes.h
@@ -51,7 +51,8 @@ typedef union
   {
     int __lock;
     unsigned int __count;
-    struct pthread *__owner;
+    int __owner;
+    unsigned int __nusers;
     /* KIND must stay at this position in the structure to maintain
        binary compatibility.  */
     int __kind;
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
index b64953ba83..b2b4449554 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_timedwait.S
@@ -91,7 +91,8 @@ __pthread_cond_timedwait:
 
 	/* Unlock the mutex.  */
 2:	movq	16(%rsp), %rdi
-	callq	__pthread_mutex_unlock_internal
+	xorq	%rsi, %rsi
+	callq	__pthread_mutex_unlock_usercnt
 
 	testl	%eax, %eax
 	jne	16f
diff --git a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
index 2c6c6ce338..3942faf1ad 100644
--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
+++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S
@@ -136,7 +136,8 @@ __pthread_cond_wait:
 
 	/* Unlock the mutex.  */
 2:	movq	16(%rsp), %rdi
-	callq	__pthread_mutex_unlock_internal
+	xorq	%rsi, %rsi
+	callq	__pthread_mutex_unlock_usercnt
 
 	testl	%eax, %eax
 	jne	12f
diff --git a/nptl/sysdeps/x86_64/tls.h b/nptl/sysdeps/x86_64/tls.h
index 973b242b4e..999c3aa55a 100644
--- a/nptl/sysdeps/x86_64/tls.h
+++ b/nptl/sysdeps/x86_64/tls.h
@@ -161,10 +161,6 @@ typedef struct
 	  : "i" (offsetof (struct pthread, header.self)));	 	      \
      __self;})
 
-/* Identifier for the current thread.  THREAD_SELF is usable but
-   sometimes more expensive than necessary.  It is fine here.  */
-# define THREAD_ID THREAD_SELF
-
 
 /* Read member of the thread descriptor directly.  */
 # define THREAD_GETMEM(descr, member) \