Date: Tue, 25 Aug 1998 23:54:33 +0900 (JST) From: Michael Hancock <michaelh@cet.co.jp> To: Julian Elischer <julian@whistle.com> Cc: current@FreeBSD.ORG Subject: Re: locking in -current. donate 15 minutes. Message-ID: <Pine.SV4.3.95.980825232310.19157B-100000@parkplace.cet.co.jp> In-Reply-To: <35E1BB8A.237C228A@whistle.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 24 Aug 1998, Julian Elischer wrote: > "when exactly is the right time to use the "interlock" locks in vnode > locking an dwhat do they do? > An interlock is a very short term lock while a full vnode lock is a relatively long term lock that is usually acquired during a lookup and held until the operation is complete. An interlock is used for things like incrementing refcounts and in acquiring a vnode lock. Note the interlock is acquired and released when acquiring a vnode lock. When an interlock is already held the LK_INTERLOCK flag indicates that acquiring the interlock isn't necessary and to just release it when done. In general you don't want to hold vnode locks very long either, but along with Kirk's softupdate changes I noticed that he holds vnode locks over operations where he didn't hold them before. Which leads me to think that these particular operations no longer block under softupdates. It also seems to mean that it is ok to hold it over hundreds of lines of code that operate on in-core data structures as long as they don't block. Anyway, being able to hold the lock over these operations makes it easier because you don't have to enter a race to reacquire the vnode lock. Reference counts can be held much longer so in some situations it is advantageous to separate a vput() into an VOP_UNLOCK() and delay the dereference until the end of the entire operation. Regards, Mike Hancock To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SV4.3.95.980825232310.19157B-100000>