[patch] lockdep: add more rwsem.h documentation
From: Ingo Molnar
Date: Tue Jul 04 2006 - 09:49:26 EST
* Ingo Molnar <mingo@xxxxxxx> wrote:
> i think you misunderstood what nested locking means in the lockdep
> case. (and that is my fault, for not adding enough documentation to
> down_write_nested() and down_read_nested().)
the patch below adds more documentation.
Ingo
---------------->
Subject: [patch] lockdep: add more rwsem.h documentation
From: Ingo Molnar <mingo@xxxxxxx>
add more documentation to rwsem.h.
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
include/linux/rwsem.h | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
Index: linux/include/linux/rwsem.h
===================================================================
--- linux.orig/include/linux/rwsem.h
+++ linux/include/linux/rwsem.h
@@ -61,12 +61,25 @@ extern void downgrade_write(struct rw_se
#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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/