svn commit: r273966 - in head: share/man/man9 sys/kern sys/sys

Attilio Rao attilio at freebsd.org
Sun Nov 2 15:54:48 UTC 2014


On Sun, Nov 2, 2014 at 2:10 PM, Konstantin Belousov <kib at freebsd.org> wrote:
> Author: kib
> Date: Sun Nov  2 13:10:31 2014
> New Revision: 273966
> URL: https://svnweb.freebsd.org/changeset/base/273966
>
> Log:
>   Fix two issues with lockmgr(9) LK_CAN_SHARE() test, which determines
>   whether the shared request for already shared-locked lock could be
>   granted.  Both problems result in the exclusive locker starvation.
>
>   The concurrent exclusive request is indicated by either
>   LK_EXCLUSIVE_WAITERS or LK_EXCLUSIVE_SPINNERS flags.  The reverse
>   condition, i.e. no exclusive waiters, must check that both flags are
>   cleared.
>
>   Add a flag LK_NODDLKTREAT for shared lock request to indicate that
>   current thread guarantees that it does not own the lock in shared
>   mode.  This turns back the exclusive lock starvation avoidance code;
>   see man page update for detailed description.
>
>   Use LK_NODDLKTREAT when doing lookup(9).

The right way to implement this (selectively disabling writer
starvation avoidance) must be on a lock-basis.
So you need a new flag to pass to lockinit(). This is to support it "globaly".
Then, you can pass it on a lockmgr() instance basis (like FreeBSD also
passes, for example, LK_NOWITNESS).
You can use it during lookup() calls. Maybe you will need to propagate
it via the vn_lock() interface.

The patch will be bigger but much cleaner and more correct than what
is in head now.

Attilio


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


More information about the svn-src-head mailing list