diff options
author | DJ Delorie <dj@redhat.com> | 2019-08-08 19:09:43 -0400 |
---|---|---|
committer | Arjun Shankar <ashankar@redhat.com> | 2019-10-30 19:03:40 +0100 |
commit | cb89ba9c72f66327f5d66034681eb1d46eedf96f (patch) | |
tree | 58411fc25a50ea7c269387e2bcfe64eba11ffe00 /malloc/malloc.c | |
parent | a645c48756f04d757c69740be0eaa6ffb5f47e3b (diff) | |
download | glibc-cb89ba9c72f66327f5d66034681eb1d46eedf96f.tar.gz glibc-cb89ba9c72f66327f5d66034681eb1d46eedf96f.tar.xz glibc-cb89ba9c72f66327f5d66034681eb1d46eedf96f.zip |
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> (cherry picked from commit c48d92b430c480de06762f80c104922239416826)
Diffstat (limited to 'malloc/malloc.c')
-rw-r--r-- | malloc/malloc.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c index 22f1049056..23dd6054c5 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -5140,6 +5140,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) { @@ -5159,13 +5172,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: |