Skip to content

Commit 6d5f0eb

Browse files
committed
Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull core locking updates from Ingo Molnar: "The main updates in this cycle were: - mutex MCS refactoring finishing touches: improve comments, refactor and clean up code, reduce debug data structure footprint, etc. - qrwlock finishing touches: remove old code, self-test updates. - small rwsem optimization - various smaller fixes/cleanups" * 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: locking/lockdep: Revert qrwlock recusive stuff locking/rwsem: Avoid double checking before try acquiring write lock locking/rwsem: Move EXPORT_SYMBOL() lines to follow function definition locking/rwlock, x86: Delete unused asm/rwlock.h and rwlock.S locking/rwlock, x86: Clean up asm/spinlock*.h to remove old rwlock code locking/semaphore: Resolve some shadow warnings locking/selftest: Support queued rwlock locking/lockdep: Restrict the use of recursive read_lock() with qrwlock locking/spinlocks: Always evaluate the second argument of spin_lock_nested() locking/Documentation: Update locking/mutex-design.txt disadvantages locking/Documentation: Move locking related docs into Documentation/locking/ locking/mutexes: Use MUTEX_SPIN_ON_OWNER when appropriate locking/mutexes: Refactor optimistic spinning code locking/mcs: Remove obsolete comment locking/mutexes: Document quick lock release when unlocking locking/mutexes: Standardize arguments in lock/unlock slowpaths locking: Remove deprecated smp_mb__() barriers
2 parents dbb885f + 8acd91e commit 6d5f0eb

30 files changed

Lines changed: 282 additions & 483 deletions

‎Documentation/00-INDEX‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ local_ops.txt
287287
- semantics and behavior of local atomic operations.
288288
lockdep-design.txt
289289
- documentation on the runtime locking correctness validator.
290+
locking/
291+
- directory with info about kernel locking primitives
290292
lockstat.txt
291293
- info on collecting statistics on locks (and contention).
292294
lockup-watchdogs.txt

‎Documentation/DocBook/kernel-locking.tmpl‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ machines due to caching.
19721972
<itemizedlist>
19731973
<listitem>
19741974
<para>
1975-
<filename>Documentation/spinlocks.txt</filename>:
1975+
<filename>Documentation/locking/spinlocks.txt</filename>:
19761976
Linus Torvalds' spinlocking tutorial in the kernel sources.
19771977
</para>
19781978
</listitem>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Because things like lock contention can severely impact performance.
1212
- HOW
1313

1414
Lockdep already has hooks in the lock functions and maps lock instances to
15-
lock classes. We build on that (see Documentation/lockdep-design.txt).
15+
lock classes. We build on that (see Documentation/lokcing/lockdep-design.txt).
1616
The graph below shows the relation between the lock functions and the various
1717
hooks therein.
1818

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ Disadvantages
145145

146146
Unlike its original design and purpose, 'struct mutex' is larger than
147147
most locks in the kernel. E.g: on x86-64 it is 40 bytes, almost twice
148-
as large as 'struct semaphore' (24 bytes) and 8 bytes shy of the
149-
'struct rw_semaphore' variant. Larger structure sizes mean more CPU
150-
cache and memory footprint.
148+
as large as 'struct semaphore' (24 bytes) and tied, along with rwsems,
149+
for the largest lock in the kernel. Larger structure sizes mean more
150+
CPU cache and memory footprint.
151151

152152
When to use mutexes
153153
-------------------
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ never used in interrupt handlers, you can use the non-irq versions:
105105
spin_unlock(&lock);
106106

107107
(and the equivalent read-write versions too, of course). The spinlock will
108-
guarantee the same kind of exclusive access, and it will be much faster.
108+
guarantee the same kind of exclusive access, and it will be much faster.
109109
This is useful if you know that the data in question is only ever
110-
manipulated from a "process context", ie no interrupts involved.
110+
manipulated from a "process context", ie no interrupts involved.
111111

112112
The reasons you mustn't use these versions if you have interrupts that
113113
play with the spinlock is that you can get deadlocks:
@@ -122,21 +122,21 @@ the other interrupt happens on another CPU, but it is _not_ ok if the
122122
interrupt happens on the same CPU that already holds the lock, because the
123123
lock will obviously never be released (because the interrupt is waiting
124124
for the lock, and the lock-holder is interrupted by the interrupt and will
125-
not continue until the interrupt has been processed).
125+
not continue until the interrupt has been processed).
126126

127127
(This is also the reason why the irq-versions of the spinlocks only need
128128
to disable the _local_ interrupts - it's ok to use spinlocks in interrupts
129129
on other CPU's, because an interrupt on another CPU doesn't interrupt the
130130
CPU that holds the lock, so the lock-holder can continue and eventually
131-
releases the lock).
131+
releases the lock).
132132

133133
Note that you can be clever with read-write locks and interrupts. For
134134
example, if you know that the interrupt only ever gets a read-lock, then
135135
you can use a non-irq version of read locks everywhere - because they
136-
don't block on each other (and thus there is no dead-lock wrt interrupts.
137-
But when you do the write-lock, you have to use the irq-safe version.
136+
don't block on each other (and thus there is no dead-lock wrt interrupts.
137+
But when you do the write-lock, you have to use the irq-safe version.
138138

139-
For an example of being clever with rw-locks, see the "waitqueue_lock"
139+
For an example of being clever with rw-locks, see the "waitqueue_lock"
140140
handling in kernel/sched/core.c - nothing ever _changes_ a wait-queue from
141141
within an interrupt, they only read the queue in order to know whom to
142142
wake up. So read-locks are safe (which is good: they are very common

‎MAINTAINERS‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5680,8 +5680,8 @@ M: Ingo Molnar <mingo@redhat.com>
56805680
L: linux-kernel@vger.kernel.org
56815681
T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core/locking
56825682
S: Maintained
5683-
F: Documentation/lockdep*.txt
5684-
F: Documentation/lockstat.txt
5683+
F: Documentation/locking/lockdep*.txt
5684+
F: Documentation/locking/lockstat.txt
56855685
F: include/linux/lockdep.h
56865686
F: kernel/locking/
56875687

0 commit comments

Comments
 (0)