1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

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>
This commit is contained in:
Cupertino Miranda
2023-04-14 16:12:20 +01:00
committed by Adhemerval Zanella
parent 0f61cd4b9c
commit b630be0922
7 changed files with 42 additions and 0 deletions

View File

@@ -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));
}