From dd45734e322a03287d34d8af9b7da7b35cfddb8e Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Mon, 28 Jun 2021 15:48:58 +0200 Subject: 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 --- nptl/pthread_mutex_conf.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'nptl/pthread_mutex_conf.c') diff --git a/nptl/pthread_mutex_conf.c b/nptl/pthread_mutex_conf.c index e6235de..c8f171c 100644 --- a/nptl/pthread_mutex_conf.c +++ b/nptl/pthread_mutex_conf.c @@ -23,6 +23,7 @@ #include #include /* Get STDOUT_FILENO for _dl_printf. */ #include +#include 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 -- cgit v1.1