From: Ingo Molnar <mingo@elte.hu>
To: David Howells <dhowells@redhat.com>
Cc: Arjan van de Ven <arjan@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
torvalds@osdl.org, akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: [patch] lockdep: add more rwsem.h documentation
Date: Tue, 4 Jul 2006 15:33:19 +0200 [thread overview]
Message-ID: <20060704133319.GA8372@elte.hu> (raw)
In-Reply-To: <20060704132135.GA7816@elte.hu>
* Ingo Molnar <mingo@elte.hu> 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@elte.hu>
add more documentation to rwsem.h.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
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);
prev parent reply other threads:[~2006-07-04 13:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-04 12:47 R/W semaphore changes David Howells
2006-07-04 12:52 ` Arjan van de Ven
2006-07-04 13:05 ` David Howells
2006-07-04 13:17 ` Arjan van de Ven
2006-07-04 13:21 ` Ingo Molnar
2006-07-04 13:33 ` Ingo Molnar [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060704133319.GA8372@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@osdl.org \
--cc=arjan@infradead.org \
--cc=dhowells@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox