]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Move __default_stacksize into __default_pthread_attr
authorSiddhesh Poyarekar <siddhesh@redhat.com>
Tue, 19 Mar 2013 09:04:13 +0000 (14:34 +0530)
committerSiddhesh Poyarekar <siddhesh@redhat.com>
Tue, 19 Mar 2013 09:04:13 +0000 (14:34 +0530)
Make __default_pthread_attr object to store default attribute values
for threads.

nptl/ChangeLog
nptl/allocatestack.c
nptl/nptl-init.c
nptl/pthreadP.h
nptl/pthread_attr_getstacksize.c
nptl/pthread_create.c
nptl/vars.c

index db98d4e9ca86f4b1dd9c114375d0108ae65f3be4..12a8ffde8c5453c4351fdacae830ade8b530d848 100644 (file)
@@ -1,3 +1,19 @@
+2013-03-19  Siddhesh Poyarekar  <siddhesh@redhat.com>
+
+       * allocatestack.c (allocate_stack): Use __default_attr instead
+       of __default_stacksize.
+       * nptl-init.c (__pthread_initialize_minimal_internal):
+       Likewise.  Initialize guardsize.
+       * pthreadP.h (__default_attr): Declare.
+       * pthread_attr_getstacksize.c (__pthread_attr_getstacksize):
+       Use __default_attr instead of __default_stacksize.
+       * pthread_create.c (default_attr): Remove.
+       (__pthread_create_2_1): Use __default_attr instead of
+       default_attr.
+       * vars.c (__default_stacksize): Remove.
+       (__default_attr): New static variable to store
+       default thread attributes.
+
 2013-03-18  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
        * pthread_barrier_init.c (default_attr): Rename to
index 31c88291ae91b3e940a8f41da8ff49a44038ec6d..56bf2570f84e0c0cf8e7be4dcff84cf29f87b660 100644 (file)
@@ -358,7 +358,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 
   /* Get the stack size from the attribute if it is set.  Otherwise we
      use the default we determined at start time.  */
-  size = attr->stacksize ?: __default_stacksize;
+  size = attr->stacksize ?: __default_pthread_attr.stacksize;
 
   /* Get memory for the stack.  */
   if (__builtin_expect (attr->flags & ATTR_FLAG_STACKADDR, 0))
index 19e66164202c118f12a81f69c2567a78fb3e73f9..63fb729fc67abb2439d47f2cac9a9576105736d7 100644 (file)
@@ -423,7 +423,8 @@ __pthread_initialize_minimal_internal (void)
 
   /* Round the resource limit up to page size.  */
   limit.rlim_cur = (limit.rlim_cur + pagesz - 1) & -pagesz;
-  __default_stacksize = limit.rlim_cur;
+  __default_pthread_attr.stacksize = limit.rlim_cur;
+  __default_pthread_attr.guardsize = GLRO (dl_pagesize);
 
 #ifdef SHARED
   /* Transfer the old value from the dynamic linker's internal location.  */
index d08b219b5db12f2b51a8579fe7112e1dd18149e9..954b54a50a1388ae648cfeb7e9403b56aea395aa 100644 (file)
@@ -147,8 +147,8 @@ enum
 /* Internal variables.  */
 
 
-/* Default stack size.  */
-extern size_t __default_stacksize attribute_hidden;
+/* Default pthread attributes.  */
+extern struct pthread_attr __default_pthread_attr attribute_hidden;
 
 /* Size and alignment of static TLS block.  */
 extern size_t __static_tls_size attribute_hidden;
index 6df70623e83b92194e15208da9634303743e7aaf..42d3f8f44c1da87559a70bcdf46bfe14a98205c0 100644 (file)
@@ -32,7 +32,7 @@ __pthread_attr_getstacksize (attr, stacksize)
 
   /* If the user has not set a stack size we return what the system
      will use as the default.  */
-  *stacksize = iattr->stacksize ?: __default_stacksize;
+  *stacksize = iattr->stacksize ?: __default_pthread_attr.stacksize;
 
   return 0;
 }
index c6f2fdd724d6832b6e57ecb0e99185f0ffb14168..c18278cf08c8ef1d6ad49ae6eafd2e3bf16b5788 100644 (file)
@@ -435,15 +435,6 @@ start_thread (void *arg)
 }
 
 
-/* Default thread attributes for the case when the user does not
-   provide any.  */
-static const struct pthread_attr default_attr =
-  {
-    /* Just some value > 0 which gets rounded to the nearest page size.  */
-    .guardsize = 1,
-  };
-
-
 int
 __pthread_create_2_1 (newthread, attr, start_routine, arg)
      pthread_t *newthread;
@@ -457,7 +448,7 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg)
   if (iattr == NULL)
     /* Is this the best idea?  On NUMA machines this could mean
        accessing far-away memory.  */
-    iattr = &default_attr;
+    iattr = &__default_pthread_attr;
 
   struct pthread *pd = NULL;
   int err = ALLOCATE_STACK (iattr, &pd);
index 2bcd1f8e0a000206207a709175bc2d9137dfe4f3..45ca486143cd1a93ed80a28f80e8bbadae020e80 100644 (file)
 #include <tls.h>
 #include <unistd.h>
 
-/* Default stack size.  */
-size_t __default_stacksize attribute_hidden
-#ifdef SHARED
-;
-#else
-  = PTHREAD_STACK_MIN;
-#endif
+/* Default thread attributes for the case when the user does not
+   provide any.  */
+struct pthread_attr __default_pthread_attr attribute_hidden;
 
 /* Flag whether the machine is SMP or not.  */
 int __is_smp attribute_hidden;