tech-kern archive

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

Re: rwlock performance

Iain Hibbert <> wrote:
> > RW locks have some performance problems, and they should not be used
> > until it's needed. I think that same think can be accomplished by using
> > reference counters and mutexes/cv variables.
> Is that in general or is that just our implementation?  I mean, if the
> same thing can be made out of mutex/refcount/condvar, and if rwlocks are
> generally useful then can the rwlock code be reimplemented in a more
> efficient manner?

It is a general problem with RW-lock on MP systems.  Basically, there is
still a mutual exclusion on a reader side, because of state (i.e. lock data)
modification, which means cache-line locking and data synchronisation with
other CPUs (at hardware level).

However, it does not mean that RW-lock should be abandoned, e.g. RW-lock is
suitable for heavy-weight synchronisation or paths which are not that often
and/or performance-critical.


Home | Main Index | Thread Index | Old Index