tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mutexes, locks and so on...



On Nov,Friday 19 2010, at 1:04 PM, Johnny Billquist wrote:

> On 11/19/10 01:50, Johnny Billquist wrote:
>> mutex exit spin with unlock appears to totally have been because some
>> spin locks were managed to be taken though mutex_vector_enter, even
>> though I have a mutex_spin_enter. I have no idea how on earth that path
>> would be possible, but after changing the code that takes spin locks in
>> mutex_vector_enter to match the code I have in mutex_spin_enter, that
>> counter is now zero.
> 
> Doh! Stupid of me. I just realized how mutexes can be taken without ever 
> passing through mutex_enter or mutex_vector_enter, even if they are defined. 
> We also have mutex_tryenter, which cannot be redefined.
> 
> Sigh! The mutex implementation is pretty broken. It basically cannot work 
> with a different implementation than the default one, and if it ever do, it 
> must be more from pure luck than any design.
> 
> We should rewrite all of the lock, mutex and rwlock api. Anyone feel like 
> doing the work with me? Or do people think that it's time better spent doing 
> something else? :-)

Andy spent a lot of time by benchmarking and optimizing mutexes and rwlocks to 
their actual state. He has done great job. Your rewritten mutexes  probably 
need have better or at least equal performance and will have to have  same api 
like old ones.

Regards

Adam.



Home | Main Index | Thread Index | Old Index