[PATCH v3] nptl: Optimize trylock for high cache contention workloads (BZ #33704)
Yann Droneaud
yann@droneaud.fr
Thu Dec 18 13:00:28 GMT 2025
Hi,
Le 17/12/2025 à 00:06, Florian Weimer a écrit :
> * Yann Droneaud:
>
>> as lll_trylock() is a macro, could the relaxed load be inserted into
>> it, providing the improvement to other user of lll_trylock() ?
> Direct CAS for an uncontended lock is better because it avoids a shared
> → exclusive cacheline transition, so it's less clear if the change is
> beneficial at the lll_trylock layer. This is not a concern for
> pthread_mutex_trylock because it reads the type member first, which is
> with some likelihood on the same cacheline (but not guaranteed to be).
OK.
I was thinking of pthread_mutex_timedlock() with a deadline in the past,
which seems to me equivalent to pthread_mutex_trylock(), shouldn't it be
concerned by the same improvement ?
Regards.
--
Yann
More information about the Libc-alpha
mailing list