Greg Troxel <gdt%ir.bbn.com@localhost> writes: > Thor Lancelot Simon <tls%panix.com@localhost> writes: > >> On Mon, Mar 26, 2012 at 02:38:44PM -0400, Beverly Schwartz wrote: >>> Here at BBN, we are getting a hang with heavy use of networking code >>> and looking for possible deadlocks. We've made modifications to the >>> kernel. I'm trying to understand the lock order invariants to make >>> sure we have applied it correctly to our code. >> >> Generally speaking, I don't think we require locks to be released >> in order - though of course it is good practice. > > I'd agree with that, but I think Bev is concerned about two locks A and > B where the taking order is A then B and > > take A > take B > release A > * > take A > > and if someone else grabs A at *, then the other is waiting for B and we > are waiting for B. So out of order releasing seems fine, but once > starting to release I think you have to release all the way. > But I am feeling a bit fuzzy on this. so self-replying in light of yamt@'s answer, I remember now that the kernel lock is special in that processes that try to take a mutex while holding the kernel lock will give up the kernel lock while sleeping and then reacquire it on waking.
Attachment:
pgpeYBu0cCQDH.pgp
Description: PGP signature