[PATCH 0/9] malloc: Remove fastbins
Dev Jain
dev.jain@arm.com
Mon Nov 3 12:39:14 GMT 2025
On 17/10/25 2:36 pm, Dev Jain wrote:
> The small tcache data structure is similar to the fastbin layer - we have
> size classes in which we store same size chunks. After the tcache was
> introduced in malloc, the tcache precedes the fastbin when we try to
> find a victim to allocate. Similarly, the tcache precedes the fastbin
> when we free a chunk, in that we first try to push the chunk into the
> tcache and only on failure do we try the fastbins. It is, therefore,
> easy to observe that post the introduction of the tcache, the fastbin
> layer has become redundant because it serves exactly the same functionality
> as the tcache, with the extra overhead of arena locks. Therefore, it makes
> sense to completely remove this allocation layer.
>
> We leave do_set_mxfast for back-compat, and just unconditionally return 1.
>
> Upon just disabling fastbins, we get a very minor regression (~0.5%).
> Upon setting the default TCACHE_FILL_COUNT to 16, we get almost the
> same performance. Thus, experimental data also proves that removing
> the fastbin layer is a good move. We have the additional benefit of also
> making the code less complex.
>
> I have broken down this removal into patches to make life easier
> (for me and the reviewers :) )
>
> Tested on Aarch64. All patches build sequentially. All malloc tests pass
> on each patch.
>
Hello! Are there some outstanding concerns about the patchset? Please let
me know so that I can address them!
>
More information about the Libc-alpha
mailing list