about summary refs log tree commit diff
path: root/nptl/pthread_mutex_conf.c
diff options
context:
space:
mode:
authorCupertino Miranda <cupertino.miranda@oracle.com>2023-04-14 16:12:20 +0100
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2023-04-20 13:54:24 -0300
commitb630be0922dbaaa50eb174a7740f0d3fb88602da (patch)
treefa0e6bd1ef8115117c6a2090b2dd5248269609fb /nptl/pthread_mutex_conf.c
parent0f61cd4b9c5175c128311769df932c8d7694d6b6 (diff)
downloadglibc-b630be0922dbaaa50eb174a7740f0d3fb88602da.tar.gz
glibc-b630be0922dbaaa50eb174a7740f0d3fb88602da.tar.xz
glibc-b630be0922dbaaa50eb174a7740f0d3fb88602da.zip
Created tunable to force small pages on stack allocation.
Created tunable glibc.pthread.stack_hugetlb to control when hugepages
can be used for stack allocation.
In case THP are enabled and glibc.pthread.stack_hugetlb is set to
0, glibc will madvise the kernel not to use allow hugepages for stack
allocations.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Diffstat (limited to 'nptl/pthread_mutex_conf.c')
-rw-r--r--nptl/pthread_mutex_conf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/nptl/pthread_mutex_conf.c b/nptl/pthread_mutex_conf.c
index 9133384d47..6517899718 100644
--- a/nptl/pthread_mutex_conf.c
+++ b/nptl/pthread_mutex_conf.c
@@ -44,6 +44,12 @@ TUNABLE_CALLBACK (set_stack_cache_size) (tunable_val_t *valp)
   __nptl_stack_cache_maxsize = valp->numval;
 }
 
+static void
+TUNABLE_CALLBACK (set_stack_hugetlb) (tunable_val_t *valp)
+{
+  __nptl_stack_hugetlb = (int32_t) valp->numval;
+}
+
 void
 __pthread_tunables_init (void)
 {
@@ -51,4 +57,6 @@ __pthread_tunables_init (void)
                TUNABLE_CALLBACK (set_mutex_spin_count));
   TUNABLE_GET (stack_cache_size, size_t,
                TUNABLE_CALLBACK (set_stack_cache_size));
+  TUNABLE_GET (stack_hugetlb, int32_t,
+	       TUNABLE_CALLBACK (set_stack_hugetlb));
 }