[PATCH v4 0/7] malloc: tcache improvements

Cupertino Miranda cupertino.miranda@oracle.com
Fri Mar 14 17:32:06 GMT 2025


+attachments

On 14-03-2025 17:29, Cupertino Miranda wrote:
> Hi everyone,
> 
> This new version is the result of the recent interactions with Wilco
> Dijkstra relating performance degradation detected in previous version.
> I will reply to this cover letter with an attached spreadsheet and chart
> image.
> 
> Presented results were collected with mimalloc-bench, executed with the
> following code variations:
>   - master as the baseline,
>   - v3 (patches 1 to 3),
>   - v3 (all 5 patches),
>   - inline (with __always_inline in tcache_free),
>   - v4 (recent changes to improve performance: added fast_csize2tidx,
>     trim spurious conditions and adding __glibc_(un)likely to
>     conditions).
> 
> All results were taken without any tunables set, i.e. the tcache should
> behave as originally intended in glibc malloc.
> 
> Looking forward to your comments.
> 
> Best regards,
> Cupertino
> 
> Changes from v3:
>   - force inline of _int_free. This might make sense as a generic patch.
>   - performance improvements
> Changes from v2:
>   - Redesign implementation.
>   - Dropped strategy to remove old chunks from tcache to a better
>     split and consolidate strategy (future patch, still work in
>     progress).
>   - Fixed regressions in v2.
> Changes from v1:
>   - Typo in the assigment to mp_.tcache_bins in do_set_cache_max
>     function. Was setting it to MAX_TCACHE_SIZE instead of
>     TCACHE_MAX_BINS.
>   - Fixed testsuite regressions.
> 
> Cupertino Miranda (7):
>    malloc: missing initialization of tcache in _mid_memalign
>    malloc: mangle tcache entries pointers
>    malloc: replace _int_free by _int_free_chunk in sysmalloc.
>    malloc: add tcache support for large chunk caching
>    malloc: add testing for large tcache support.
>    malloc: force inline of _int_free
>    malloc: performance improvements
> 
>   Rules           |  19 ++++++
>   malloc/Makefile |  15 +++++
>   malloc/arena.c  |   2 +-
>   malloc/malloc.c | 156 ++++++++++++++++++++++++++++++++----------------
>   4 files changed, 139 insertions(+), 53 deletions(-)
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: chart.png
Type: image/png
Size: 48292 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250314/fdec3270/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: results.ods
Type: application/vnd.oasis.opendocument.spreadsheet
Size: 73422 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/libc-alpha/attachments/20250314/fdec3270/attachment-0001.ods>


More information about the Libc-alpha mailing list