Re: shared lwkt locks
Matthew Dillon <[email protected]> Thu, 16 Jul 2015 17:54:37 -0700
| Newsgroups | gmane.os.dragonfly-bsd.kernel |
|---|---|
| Message-ID | <CAOZ7CpAk8R=P58=tz6UzAf+Cheazpe6Q5EKXWGVXFM-b-R8ROw@mail.gmail.com> |
Lock releases must match lock acquisitions. lwkt_tokens have an additional requirement that lock releases must be performed in exactly the reverse order as the acquires. So if you acquire A, B, C, B, X, Y you have to release in reverse, Y, X , B, C, B, A. Shared tokens are very dangerous and must be used carefully. The vm_object code is the most complex code in the kernel that uses shared tokens, and as you can see by reading it, it can get nasty because a particular token cannot mix shared and exclusive use in the same thread. I'm not sure which warning you are talking about, where in vm_object_drop() ? -Matt On Thu, Jul 16, 2015 at 5:31 PM, Alex Merritt <[email protected]> wrote: > Hi, > > Does releasing a lwkt_token release all prior gettoken_shared invocations > to that lock, or is one required to perform reltoken as many times as > you've performed gettoken_shared? There is a warning in vm_object_drop that > the lock may be shared -- I was wondering what exactly that warning is > meant to warn against. Apologies if the answer is apparent somewhere. > > Thanks, > Alex >