diff options
author | DJ Delorie <dj@redhat.com> | 2019-08-08 19:09:43 -0400 |
---|---|---|
committer | DJ Delorie <dj@redhat.com> | 2019-08-09 14:04:03 -0400 |
commit | c48d92b430c480de06762f80c104922239416826 (patch) | |
tree | efb687b05fe7b94025ad29c6fe35d1d60a336fb8 /malloc/malloc.c | |
parent | b6d2c4475d5abc05dd009575b90556bdd3c78ad0 (diff) | |
download | glibc-c48d92b430c480de06762f80c104922239416826.tar.gz |
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>
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 0e65d636cd..fe973770a6 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -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: |