linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Byungchul Park <byungchul.park@lge.com>
To: peterz@infradead.org, mingo@kernel.org
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, linux-block@vger.kernel.org,
	kernel-team@lge.com
Subject: [PATCH v3 4/5] locking/Documentation: Add an example to help crossrelease.txt more readable
Date: Sat, 11 Nov 2017 22:26:31 +0900	[thread overview]
Message-ID: <1510406792-28676-5-git-send-email-byungchul.park@lge.com> (raw)
In-Reply-To: <1510406792-28676-1-git-send-email-byungchul.park@lge.com>

Add an example explaining the rationale that the limitation that old
lockdep implies, can be relaxed.

Signed-off-by: Byungchul Park <byungchul.park@lge.com>
---
 Documentation/locking/crossrelease.txt | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/Documentation/locking/crossrelease.txt b/Documentation/locking/crossrelease.txt
index bb449e8..dac56f4 100644
--- a/Documentation/locking/crossrelease.txt
+++ b/Documentation/locking/crossrelease.txt
@@ -281,6 +281,29 @@ causes a deadlock. The more lockdep adds dependencies, the more it
 thoroughly works. Thus, lockdep has to do its best to detect and add as
 many true dependencies to the graph as possible.
 
+For example:
+
+   CONTEXT X			   CONTEXT Y
+   ---------			   ---------
+				   acquire A
+   acquire B /* A dependency 'A -> B' exists */
+   release B
+   release A held by Y
+
+   where A and B are different lock classes.
+
+In this case, a dependency 'A -> B' exists since:
+
+   1. A waiter for A and a waiter for B might exist when acquiring B.
+   2. The only way to wake up each is to release what it waits for.
+   3. Whether the waiter for A can be woken up depends on whether the
+      other can. In other words, CONTEXT X cannot release A if it fails
+      to acquire B.
+
+Considering only typical locks, lockdep builds nothing. However,
+relaxing the limitation, a dependency 'A -> B' can be added, giving us
+more chances to check circular dependencies.
+
 However, it might suffer performance degradation since
 relaxing the limitation, with which design and implementation of lockdep
 can be efficient, might introduce inefficiency inevitably. So lockdep
-- 
1.9.1

  parent reply	other threads:[~2017-11-11 13:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-11 13:26 [PATCH v3 0/5] Revise crossrelease.txt Byungchul Park
2017-11-11 13:26 ` [PATCH v3 1/5] locking/Documentation: Remove meaningless examples and a note Byungchul Park
2017-11-11 13:26 ` [PATCH v3 2/5] locking/Documentation: Fix typos and clear grammar errors Byungchul Park
2017-11-11 13:26 ` [PATCH v3 3/5] locking/Documentation: Fix weird expressions Byungchul Park
2017-11-11 13:26 ` Byungchul Park [this message]
2017-11-11 13:26 ` [PATCH v3 5/5] locking/Documentation: Align crossrelease.txt with the width Byungchul Park
2017-11-11 13:33 ` [PATCH] locking/Documentation: Revise Documentation/locking/crossrelease.txt Byungchul Park
2017-11-11 13:45   ` Byungchul Park
2017-11-16  0:04     ` Byungchul Park
2017-11-16  7:22       ` Ingo Molnar
2017-11-16  7:36         ` Byungchul Park
2017-12-04  0:15         ` Byungchul Park

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=1510406792-28676-5-git-send-email-byungchul.park@lge.com \
    --to=byungchul.park@lge.com \
    --cc=kernel-team@lge.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).