[PATCH] Unify pthread_spin_[try]lock implementations.

Jeff Law law@redhat.com
Wed Aug 15 17:05:00 GMT 2012


On 08/15/2012 10:39 AM, Maxim Kuvyrkov wrote:
>>
>>> +#define SPIN_LOCK_READS_BETWEEN_CMPXCHG 1000
>>> +#include_next <nptl/pthread_spin_lock.c>
I haven't followed this discussion closely,so if I'm bringing up an 
issue which you're already dealing with or have plans to deal with, my 
apologies.

I'm aware these constants can vary on a per-architecture basis; however, 
is any provision made for varying them within a particular architecture.

The reason I ask is once of Red Hat's partners raised an issue around 
adaptive mutexes where the upper bound for the spin count was less than 
a cache round trip on that partner's modern processors.

It seems to me that SPIN_LOCK_READS_BETWEEN_CMPXCHG may have the 
property that varying it at runtime based on the characteristics of the 
particular chip running the application might be worthwhile.

And, yes, there are some vague plans for Red Hat to write and submit 
code for the adaptive mutex issue :-)

jeff




More information about the Libc-alpha mailing list