Commit 27bd57aa authored by Nicolai Hähnle's avatar Nicolai Hähnle Committed by Ingo Molnar

locking/ww_mutex/Documentation: Update the design document

Document the invariants we maintain for the wait list of ww_mutexes.
Signed-off-by: default avatarNicolai Hähnle <>
Signed-off-by: default avatarPeter Zijlstra (Intel) <>
Cc: Andrew Morton <>
Cc: Chris Wilson <>
Cc: Daniel Vetter <>
Cc: Linus Torvalds <>
Cc: Maarten Lankhorst <>
Cc: Paul E. McKenney <>
Cc: Peter Zijlstra <>
Cc: Thomas Gleixner <>
Link: default avatarIngo Molnar <>
parent 977625a6
......@@ -309,11 +309,15 @@ Design:
normal mutex locks, which are far more common. As such there is only a small
increase in code size if wait/wound mutexes are not used.
We maintain the following invariants for the wait list:
(1) Waiters with an acquire context are sorted by stamp order; waiters
without an acquire context are interspersed in FIFO order.
(2) Among waiters with contexts, only the first one can have other locks
acquired already (ctx->acquired > 0). Note that this waiter may come
after other waiters without contexts in the list.
In general, not much contention is expected. The locks are typically used to
serialize access to resources for devices. The only way to make wakeups
smarter would be at the cost of adding a field to struct mutex_waiter. This
would add overhead to all cases where normal mutexes are used, and
ww_mutexes are generally less performance sensitive.
serialize access to resources for devices.
Special care has been taken to warn for as many cases of api abuse
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment