summary refs log tree commit diff
path: root/nptl/pthread_mutex_conf.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/pthread_mutex_conf.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/pthread_mutex_conf.c')
-rw-r--r--nptl/pthread_mutex_conf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/nptl/pthread_mutex_conf.c b/nptl/pthread_mutex_conf.c
index e6235dea47..c8f171c995 100644
--- a/nptl/pthread_mutex_conf.c
+++ b/nptl/pthread_mutex_conf.c
@@ -23,6 +23,7 @@
 #include <stdbool.h>
 #include <unistd.h>  /* Get STDOUT_FILENO for _dl_printf.  */
 #include <elf/dl-tunables.h>
+#include <nptl-stack.h>
 
 struct mutex_config __mutex_aconf =
 {
@@ -38,10 +39,18 @@ TUNABLE_CALLBACK (set_mutex_spin_count) (tunable_val_t *valp)
   __mutex_aconf.spin_count = (int32_t) (valp)->numval;
 }
 
+static void
+TUNABLE_CALLBACK (set_stack_cache_size) (tunable_val_t *valp)
+{
+  __nptl_stack_cache_maxsize = valp->numval;
+}
+
 void
 __pthread_tunables_init (void)
 {
   TUNABLE_GET (mutex_spin_count, int32_t,
                TUNABLE_CALLBACK (set_mutex_spin_count));
+  TUNABLE_GET (stack_cache_size, size_t,
+               TUNABLE_CALLBACK (set_stack_cache_size));
 }
 #endif