[PATCH v9 0/2] malloc: tcache improvements
Cupertino Miranda
cupertino.miranda@oracle.com
Tue Jun 3 18:12:13 GMT 2025
Hi everyone,
This is what I hope to be the last version of this patch series.
Looking forward to your reviews.
Cheers,
Cupertino
Changed from v8:
- Code changed after another review round from Wilco.
- Dropped tcache_index function.
- Check sizes against tcache_max_bytes to delay TLS tcache loading.
- Re-added tcache_bins, but renaming it to tcache_small_bins. Now it
only is used for small tcache chunks.
- Removed MAYBE_INIT_TCACHE, to reduce number of NULL pointer checks
against tcache TLS variable.
Changes from v7:
- Applied changes suggested by Wilcos and Andreas reviews.
- Added __libc_calloc large chunk tcache support.
- Moved tcache_init call to __libc_calloc2. Semantically it is the same
but out of the tcache hotpath.
- Only check for mp_.tcache_max_bytes when adding to tcache bins, i.e.
before any calls to tcache_put and tcache_put_large.
No need to check for tcache_max_bytes or even tcache_bins in bin
retrievals, since the bin entries will be empty when those sizes are not
added in.
- Also there is no need to check for mp_.tcache_bins around tcache_get
as the entries will be empty if there are no such chunks. I have
removed the field tcache_bins completelly.
Changes from v6:
- Dropped pointer swizzilng patch.
- Separated small and large tcache patches to reduce overhead related
to the introduction of large chunks in tcache.
Changes from v5:
- Dropped patches already pushed in upstream master.
- Adapted code to take advantage of new streamlined __libc_malloc
function by only dealing with small chunk sizes in this call.
Remaining large chunk size tcache code is moved to __libc_malloc2 which
is called by __libc_malloc as a tailcall.
Changes from v4:
- Reorganized patches from most general optimizations to large chunk
caching changes in tcache.
- Code changes related to recent reviews from Wilco and DJ.
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 (2):
malloc: add tcache support for large chunk caching
malloc: add testing for large tcache support.
Rules | 19 ++++
malloc/Makefile | 15 +++
malloc/malloc.c | 288 +++++++++++++++++++++++++++++++++---------------
3 files changed, 234 insertions(+), 88 deletions(-)
--
2.39.5
More information about the Libc-alpha
mailing list