[patch v4] malloc: avoid need for tcache == NULL checks

DJ Delorie dj@redhat.com
Fri Sep 5 19:43:43 GMT 2025


Wilco Dijkstra <Wilco.Dijkstra@arm.com> writes:
>> +#if USE_TCACHE
>
> Note we are already in a USE_TCACHE block here...

Fixed.

>> I'm still concerned that tcache_init invalidates *fb because it triggers
>> consolidation.
>>
>> Wilco, what do you thinK?
>
> The victim has already been unlinked, and 'fb' is a constant offset
> from arena, so there isn't anything that could be out of date as far
> as I can see.

> So we need to look for better solutions.

My original plan was to call tcache_init as soon as malloc et al were
out of the fast path (i.e. just before the lock is taken) but it was
preferred to move it closer to when the cache was to be written to.

> hence I don't like all the on-demand initializations.

We have to, because tunables.



More information about the Libc-alpha mailing list