tech-kern archive

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

Re: mutexes, locks and so on...



On Fri, Nov 12, 2010 at 11:09:20AM +0000, Andrew Doran wrote:

> It was deliberate.  rwlocks are only effective in situations where the
> codepath is heavyweight.  So I felt while it is worthwhile optimising them
> if possible, an all out jihad is just not warranted (as it might be for
> mutexes).  So I made the decision to make them rely on CAS so that the
> implementation is transparent, easier to prove and maintain etc.

To take an example where we grab a rwlock around something that doesn't
need to be heavyweight, see stat() -> VOP_STAT().  With a bit of sneaky
re-engineering that wouldn't need to acquire real locks at all.  Something
like Linux's seqlock (poor name) would do great.  So to my mind rwlocks
in their current form are a sort of stop-gap and convenience thing.



Home | Main Index | Thread Index | Old Index