1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-05 19:35:52 +03:00

Add glibc.malloc.mxfast tunable

* elf/dl-tunables.list: Add glibc.malloc.mxfast.
* manual/tunables.texi: Document it.
* malloc/malloc.c (do_set_mxfast): New.
(__libc_mallopt): Call it.
* malloc/arena.c: Add mxfast tunable.
* malloc/tst-mxfast.c: New.
* malloc/Makefile: Add it.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
This commit is contained in:
DJ Delorie
2019-08-08 19:09:43 -04:00
parent b6d2c4475d
commit c48d92b430
7 changed files with 96 additions and 7 deletions

View File

@@ -5115,6 +5115,19 @@ do_set_tcache_unsorted_limit (size_t value)
}
#endif
static inline int
__always_inline
do_set_mxfast (size_t value)
{
if (value >= 0 && value <= MAX_FAST_SIZE)
{
LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
set_max_fast (value);
return 1;
}
return 0;
}
int
__libc_mallopt (int param_number, int value)
{
@@ -5134,13 +5147,7 @@ __libc_mallopt (int param_number, int value)
switch (param_number)
{
case M_MXFAST:
if (value >= 0 && value <= MAX_FAST_SIZE)
{
LIBC_PROBE (memory_mallopt_mxfast, 2, value, get_max_fast ());
set_max_fast (value);
}
else
res = 0;
do_set_mxfast (value);
break;
case M_TRIM_THRESHOLD: