2000-11-07 01:15:24

by Rick Lindsley

[permalink] [raw]
Subject: Comprehensive list of locks available?

Now that we've taken to heart the "one lock does not fit all" and we
made the kernel increasingly fine-grained with regards to locking,
there are many more locks appearing in the code. While Linux does not
currently support hierarchical locks, it is still true that the order
in which you acquire multiple locks (when needed) can be your first
defense against inadvertent deadlock. Knowing how to properly utilize a
lock is becoming increasingly important.

Has anybody documented, in total or in part, how the various locks are
to be used? A quick scan of the 2.4 source indicates there may be more
than 400 non-static spinlocks right now. I've checked the Documentation
directory and although there's a little "how-to" from Linus there on
how to properly use spinlocks, there does not (yet) appear to be any
document on the proper use of specific spinlocks.

I suspect once I start digging that there will undoubtedly be nuggets
of information in the comments in the source code. But before I dig too
deep, let me make sure I'm not doing unnecessarily redundant work :)
Has anybody started on such a document? (Would anybody be willing to
contribute to one if I produce and coordinate it?)

Rick