diff options
author | Peter Ziljstra <peterz@infradead.org> | 2018-06-15 04:07:12 -0400 |
---|---|---|
committer | Thomas Hellstrom <thellstrom@vmware.com> | 2018-07-03 03:42:40 -0400 |
commit | 55f036ca7e74b85e34958af3d22121c656796413 (patch) | |
tree | 37bdbcea3384bb7d315f242b03ecc2bbff135f82 /Documentation/locking | |
parent | eab976693153b9854bfa83d131374748f6ca4280 (diff) |
locking: WW mutex cleanup
Make the WW mutex code more readable by adding comments, splitting up
functions and pointing out that we're actually using the Wait-Die
algorithm.
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: David Airlie <airlied@linux.ie>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-doc@vger.kernel.org
Cc: linux-media@vger.kernel.org
Cc: linaro-mm-sig@lists.linaro.org
Co-authored-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'Documentation/locking')
-rw-r--r-- | Documentation/locking/ww-mutex-design.txt | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Documentation/locking/ww-mutex-design.txt b/Documentation/locking/ww-mutex-design.txt index 34c3a1b50b9a..2fd7f2a2af21 100644 --- a/Documentation/locking/ww-mutex-design.txt +++ b/Documentation/locking/ww-mutex-design.txt | |||
@@ -32,10 +32,10 @@ the oldest task) wins, and the one with the higher reservation id (i.e. the | |||
32 | younger task) unlocks all of the buffers that it has already locked, and then | 32 | younger task) unlocks all of the buffers that it has already locked, and then |
33 | tries again. | 33 | tries again. |
34 | 34 | ||
35 | In the RDBMS literature this deadlock handling approach is called wait/wound: | 35 | In the RDBMS literature this deadlock handling approach is called wait/die: |
36 | The older tasks waits until it can acquire the contended lock. The younger tasks | 36 | The older tasks waits until it can acquire the contended lock. The younger tasks |
37 | needs to back off and drop all the locks it is currently holding, i.e. the | 37 | needs to back off and drop all the locks it is currently holding, i.e. the |
38 | younger task is wounded. | 38 | younger task dies. |
39 | 39 | ||
40 | Concepts | 40 | Concepts |
41 | -------- | 41 | -------- |
@@ -56,9 +56,9 @@ Furthermore there are three different class of w/w lock acquire functions: | |||
56 | 56 | ||
57 | * Normal lock acquisition with a context, using ww_mutex_lock. | 57 | * Normal lock acquisition with a context, using ww_mutex_lock. |
58 | 58 | ||
59 | * Slowpath lock acquisition on the contending lock, used by the wounded task | 59 | * Slowpath lock acquisition on the contending lock, used by the task that just |
60 | after having dropped all already acquired locks. These functions have the | 60 | killed its transaction after having dropped all already acquired locks. |
61 | _slow postfix. | 61 | These functions have the _slow postfix. |
62 | 62 | ||
63 | From a simple semantics point-of-view the _slow functions are not strictly | 63 | From a simple semantics point-of-view the _slow functions are not strictly |
64 | required, since simply calling the normal ww_mutex_lock functions on the | 64 | required, since simply calling the normal ww_mutex_lock functions on the |
@@ -220,7 +220,7 @@ mutexes are a natural fit for such a case for two reasons: | |||
220 | 220 | ||
221 | Note that this approach differs in two important ways from the above methods: | 221 | Note that this approach differs in two important ways from the above methods: |
222 | - Since the list of objects is dynamically constructed (and might very well be | 222 | - Since the list of objects is dynamically constructed (and might very well be |
223 | different when retrying due to hitting the -EDEADLK wound condition) there's | 223 | different when retrying due to hitting the -EDEADLK die condition) there's |
224 | no need to keep any object on a persistent list when it's not locked. We can | 224 | no need to keep any object on a persistent list when it's not locked. We can |
225 | therefore move the list_head into the object itself. | 225 | therefore move the list_head into the object itself. |
226 | - On the other hand the dynamic object list construction also means that the -EALREADY return | 226 | - On the other hand the dynamic object list construction also means that the -EALREADY return |