[PATCH 3/3] malloc: Increase tcache fill count from 16 to 32

Florian Weimer fweimer@redhat.com
Thu Dec 18 11:14:13 GMT 2025


* Florian Weimer:

> This avoids a regression in the omnetpp and xalancbmk benchmarks
> of SPEC.  Apparently, these benchmarks are very sensitive to the
> fill rate in malloc.
>
> Suggested-by: Wilco Dijkstra <wilco.dijkstra@arm.com>
> Tested-by: Wilco Dijkstra <wilco.dijkstra@arm.com>
> ---
>  malloc/malloc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/malloc/malloc.c b/malloc/malloc.c
> index d42f0183e3..d60a133a06 100644
> --- a/malloc/malloc.c
> +++ b/malloc/malloc.c
> @@ -314,7 +314,7 @@
>  
>  /* This is another arbitrary limit, which tunables can change.  Each
>     tcache bin will hold at most this number of chunks.  */
> -# define TCACHE_FILL_COUNT 16
> +# define TCACHE_FILL_COUNT 32
>  
>  /* Maximum chunks in tcache bins for tunables.  This value must fit the range
>     of tcache->num_slots[] entries, else they may overflow.  */

I wonder if we could lower the fill count to 20 and use four fifth as
the malloc fill target (which would be equal to 16 once more).  That
would reduce the risk of excessive tcache retention due to doubling the
tcache size.

Thanks,
Florian



More information about the Libc-alpha mailing list