tech-kern archive

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

Re: Fileassoc locking



On Sat, Dec 26, 2009 at 06:22:36PM -0500, Elad Efrat wrote:
> 
> It is unclear to me why we need to hold a mutex (rather than merely a
> reference) when traversing a list that will not change until reference
> count has dropped. What am I missing? (See other mail about this as
> well.)

If the reference count manipulation is atomic, you do not, strictly
speaking, need the locks (if you are clever).  However, that probably
costs about as much as using a mutex, because the locked bus accesses
are the expensive part of either.

If the reference count manipulation is not atomic, you need the locks.

Thor


Home | Main Index | Thread Index | Old Index