Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 2 Nov 2014 16:54:46 +0100
From:      Attilio Rao <attilio@freebsd.org>
To:        Konstantin Belousov <kib@freebsd.org>
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>
Subject:   Re: svn commit: r273966 - in head: share/man/man9 sys/kern sys/sys
Message-ID:  <CAJ-FndB5%2BhhHprTiV1ODJoE9RNZLtOe2eQDi3MEpgPKYbM3LAw@mail.gmail.com>
In-Reply-To: <201411021310.sA2DAWmD003298@svn.freebsd.org>
References:  <201411021310.sA2DAWmD003298@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Nov 2, 2014 at 2:10 PM, Konstantin Belousov <kib@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-FndB5%2BhhHprTiV1ODJoE9RNZLtOe2eQDi3MEpgPKYbM3LAw>