summaryrefslogtreecommitdiff
path: root/include/linux/rwsem.h
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-07-10 04:44:02 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-10 13:24:14 -0700
commit5fca80e8b4bf5d69b900115b14342133ce81d79e (patch)
tree0dfa5b922438edf36ff9da2ff8a03e0d8f89c29f /include/linux/rwsem.h
parentf9829cceb686f3719215fe43c8593e5f3efe1710 (diff)
downloadlwn-5fca80e8b4bf5d69b900115b14342133ce81d79e.tar.gz
lwn-5fca80e8b4bf5d69b900115b14342133ce81d79e.zip
[PATCH] lockdep: add more rwsem.h documentation
Add more documentation to rwsem.h. Signed-off-by: Ingo Molnar <mingo@elte.hu> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/rwsem.h')
-rw-r--r--include/linux/rwsem.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 658afb37c3f5..7b524b4109a0 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -61,12 +61,25 @@ extern void downgrade_write(struct rw_semaphore *sem);
#ifdef CONFIG_DEBUG_LOCK_ALLOC
/*
- * nested locking:
+ * nested locking. NOTE: rwsems are not allowed to recurse
+ * (which occurs if the same task tries to acquire the same
+ * lock instance multiple times), but multiple locks of the
+ * same lock class might be taken, if the order of the locks
+ * is always the same. This ordering rule can be expressed
+ * to lockdep via the _nested() APIs, but enumerating the
+ * subclasses that are used. (If the nesting relationship is
+ * static then another method for expressing nested locking is
+ * the explicit definition of lock class keys and the use of
+ * lockdep_set_class() at lock initialization time.
+ * See Documentation/lockdep-design.txt for more details.)
*/
extern void down_read_nested(struct rw_semaphore *sem, int subclass);
extern void down_write_nested(struct rw_semaphore *sem, int subclass);
/*
- * Take/release a lock when not the owner will release it:
+ * Take/release a lock when not the owner will release it.
+ *
+ * [ This API should be avoided as much as possible - the
+ * proper abstraction for this case is completions. ]
*/
extern void down_read_non_owner(struct rw_semaphore *sem);
extern void up_read_non_owner(struct rw_semaphore *sem);