[PATCH 6/6] malloc: Use tailcalls in __libc_free

Florian Weimer fweimer@redhat.com
Mon Mar 31 16:41:25 GMT 2025


* Wilco Dijkstra:

> Use tailcalls to avoid the overhead of a frame on the free fastpath.
> Move tache initialization to _int_free_chunk().  Add malloc_printerr_tail()

typo: t[c]ache

> which can be tailcalled without forcing a frame like no-return functions.
> Change tcache_double_free_verify() to retry via __libc_free() after clearing
> the key.
>
> Overall performance of bench-malloc-thread improves by 29.9% for 1 thread
> and 27.1% for 32 threads on Neoverse V2.  Bench-malloc-simple improves by
> 5.9% on average (13% for single-threaded case).
>
> Passes regress, OK for commit?

Rest looks okay to me (not sure if this qualifies as a review, sorry).

Thanks,
Florian



More information about the Libc-alpha mailing list