about summary refs log tree commit diff
path: root/nptl/nptl-stack.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-06-28 15:48:58 +0200
committerFlorian Weimer <fweimer@redhat.com>2021-06-28 16:41:58 +0200
commitdd45734e322a03287d34d8af9b7da7b35cfddb8e (patch)
tree368647bd8c34ea5d1ea1f3cfa74ef52fb3271e67 /nptl/nptl-stack.c
parentfef400a2f976d1fd6a4639e6980f6c50ee13fbf5 (diff)
downloadglibc-dd45734e322a03287d34d8af9b7da7b35cfddb8e.tar.gz
glibc-dd45734e322a03287d34d8af9b7da7b35cfddb8e.tar.xz
glibc-dd45734e322a03287d34d8af9b7da7b35cfddb8e.zip
nptl: Add glibc.pthread.stack_cache_size tunable
The valgrind/helgrind test suite needs a way to make stack dealloction
more prompt, and this feature seems to be generally useful.

Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
Diffstat (limited to 'nptl/nptl-stack.c')
-rw-r--r--nptl/nptl-stack.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/nptl/nptl-stack.c b/nptl/nptl-stack.c
index 1a0c460ba8..3f33a4c20b 100644
--- a/nptl/nptl-stack.c
+++ b/nptl/nptl-stack.c
@@ -21,8 +21,7 @@
 #include <ldsodefs.h>
 #include <pthreadP.h>
 
-/* Maximum size in kB of cache.  40MiBi by default.  */
-static const size_t stack_cache_maxsize = 40 * 1024 * 1024;
+size_t __nptl_stack_cache_maxsize = 40 * 1024 * 1024;
 
 void
 __nptl_stack_list_del (list_t *elem)
@@ -103,8 +102,9 @@ queue_stack (struct pthread *stack)
   __nptl_stack_list_add (&stack->list, &GL (dl_stack_cache));
 
   GL (dl_stack_cache_actsize) += stack->stackblock_size;
-  if (__glibc_unlikely (GL (dl_stack_cache_actsize) > stack_cache_maxsize))
-    __nptl_free_stacks (stack_cache_maxsize);
+  if (__glibc_unlikely (GL (dl_stack_cache_actsize)
+			> __nptl_stack_cache_maxsize))
+    __nptl_free_stacks (__nptl_stack_cache_maxsize);
 }
 
 void