rwlocks, correctness over speed.

Attilio Rao attilio at freebsd.org
Fri Nov 23 08:48:51 PST 2007


2007/11/23, Stephan Uphoff <ups at freebsd.org>:
> Alfred Perlstein wrote:
> >
> > That's an interesting hack, I guess it could be done.
> >
> > I would still like to disallow recursion.
> >
> Oh - I am all for disallowing recursion.
> In my opinion the only valid place for a thread to acquire the same lock
> multiple times is inside a transaction system with full deadlock detection.
> The question is if we can do that this late in the game?
> Maybe we could make non recursive the default and add a call
> rw_allow_recurse  or rw_init_recurse  to allow recursion on a lock if we
> can't get away with
> the straight out removal of the option? (Or less desirable - keep the
> current default and add functions to disallow recursion)

This is still tricky as long as the other set of functions (downgrade,
upgrade, etc.) rely on the bits settings and wakeup algorithms which
will differ between the two version.

My idea is to add recursion detection for readers in witness so that
rwlock consumers which still recurse in read mode can be fixed and
later detected.

Attilio


-- 
Peace can only be achieved by understanding - A. Einstein


More information about the freebsd-arch mailing list