[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

r5738 - in glibc-package/trunk/debian: . patches patches/hurd-i386



Author: sthibault
Date: 2013-10-24 22:12:35 +0000 (Thu, 24 Oct 2013)
New Revision: 5738

Added:
   glibc-package/trunk/debian/patches/hurd-i386/cvs-libpthread-tls.diff
Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/patches/series
Log:
  * patches/hurd-i386/cvs-libpthread-tls.diff: New patch, delay TLS
    deallocation.


Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2013-10-24 22:07:17 UTC (rev 5737)
+++ glibc-package/trunk/debian/changelog	2013-10-24 22:12:35 UTC (rev 5738)
@@ -16,6 +16,8 @@
     libc outside libc.
   * patches/hurd-i386/cvs-tls-threadvar-threadself.diff: New patch, store
     pthread_self in TLS instead of threadvar.
+  * patches/hurd-i386/cvs-libpthread-tls.diff: New patch, delay TLS
+    deallocation.
 
  -- Adam Conrad <adconrad@0c3.net>  Sun, 22 Sep 2013 23:39:33 -0600
 

Added: glibc-package/trunk/debian/patches/hurd-i386/cvs-libpthread-tls.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/cvs-libpthread-tls.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/cvs-libpthread-tls.diff	2013-10-24 22:12:35 UTC (rev 5738)
@@ -0,0 +1,77 @@
+commit 96623db8d2fe02a66ac9176354634d41aca8c07d
+Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
+Date:   Wed Oct 16 01:50:52 2013 +0200
+
+    Delay TLS deallocation outside thread termination
+    
+    Since libc functions used up to actual thread termination (including the
+    termination RPC itself) are to use TLS.
+    
+    * pthread/pt-alloc.c (initialize_pthread): Set `tcb` field of `new` to NULL.
+    (__pthread_alloc): Deallocate TLS of to-be-reused `new` thread.
+    * pthread/pt-create.c (__pthread_create_internal): Reset `tcb` field to NULL
+    after deallocation.
+    * pthread/pt-exit.c (__pthread_exit): Do not deallocate TLS.
+
+--- a/libpthread/pthread/pt-alloc.c
++++ b/libpthread/pthread/pt-alloc.c
+@@ -75,6 +75,10 @@ initialize_pthread (struct __pthread *new, int recycling)
+ 
+   new->cancelation_handlers = 0;
+ 
++#ifdef ENABLE_TLS
++  new->tcb = NULL;
++#endif
++
+   new->next = 0;
+   new->prevp = 0;
+ 
+@@ -119,6 +123,15 @@ __pthread_alloc (struct __pthread **pthread)
+ 	 cases, we are interrupt it.  */
+       __pthread_thread_halt (new);
+ 
++#ifdef ENABLE_TLS
++      if (new->tcb)
++	{
++	  /* Drop old values */
++	  _dl_deallocate_tls (new->tcb, 1);
++	  new->tcb = NULL;
++	}
++#endif /* ENABLE_TLS */
++
+       err = initialize_pthread (new, 1);
+       if (! err)
+ 	*pthread = new;
+--- a/libpthread/pthread/pt-create.c
++++ b/libpthread/pthread/pt-create.c
+@@ -216,6 +216,7 @@ __pthread_create_internal (struct __pthread **thread,
+  failed_setup:
+ #ifdef ENABLE_TLS
+   _dl_deallocate_tls (pthread->tcb, 1);
++  pthread->tcb = NULL;
+  failed_thread_tls_alloc:
+ #endif /* ENABLE_TLS */
+   __pthread_thread_dealloc (pthread);
+--- a/libpthread/pthread/pt-exit.c
++++ b/libpthread/pthread/pt-exit.c
+@@ -69,11 +69,6 @@ __pthread_exit (void *status)
+   if (self->cancel_state == PTHREAD_CANCEL_ENABLE && self->cancel_pending)
+     status = PTHREAD_CANCELED;
+ 
+-#ifdef ENABLE_TLS
+-  if (self->tcb)
+-    _dl_deallocate_tls (self->tcb, 1);
+-#endif /* ENABLE_TLS */
+-
+   switch (self->state)
+     {
+     default:
+@@ -85,7 +80,7 @@ __pthread_exit (void *status)
+       /* Make sure that nobody can reference this thread anymore, and
+          mark it as terminated.  Our thread ID will immediately become
+          available for re-use.  For obvious reasons, we cannot
+-         deallocate our own stack.  However, it will eventually be
++         deallocate our own stack and TLS.  However, it will eventually be
+          reused when this thread structure is recycled.  */
+       __pthread_mutex_unlock (&self->state_lock);
+ 

Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series	2013-10-24 22:07:17 UTC (rev 5737)
+++ glibc-package/trunk/debian/patches/series	2013-10-24 22:12:35 UTC (rev 5738)
@@ -133,6 +133,7 @@
 hurd-i386/cvs-pthread_atfork.diff
 hurd-i386/tg-pipe2.diff
 hurd-i386/cvs-tls-threadvar-threadself.diff
+hurd-i386/cvs-libpthread-tls.diff
 
 i386/local-biarch.diff
 i386/local-cmov.diff


Reply to: