diff options
author | Will Deacon <will.deacon@arm.com> | 2017-11-28 18:42:19 +0000 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-12-12 11:24:01 +0100 |
commit | d89c70356acf11b7cf47ca5cfcafae5062a85451 (patch) | |
tree | 37ee5c994ea7efc53d2995e085d27ca120908b27 /Documentation/locking | |
parent | f87f3a328dbbb3e79dd53e7e889ced9222512649 (diff) | |
download | talos-obmc-linux-d89c70356acf11b7cf47ca5cfcafae5062a85451.tar.gz talos-obmc-linux-d89c70356acf11b7cf47ca5cfcafae5062a85451.zip |
locking/core: Remove break_lock field when CONFIG_GENERIC_LOCKBREAK=y
When CONFIG_GENERIC_LOCKBEAK=y, locking structures grow an extra int ->break_lock
field which is used to implement raw_spin_is_contended() by setting the field
to 1 when waiting on a lock and clearing it to zero when holding a lock.
However, there are a few problems with this approach:
- There is a write-write race between a CPU successfully taking the lock
(and subsequently writing break_lock = 0) and a waiter waiting on
the lock (and subsequently writing break_lock = 1). This could result
in a contended lock being reported as uncontended and vice-versa.
- On machines with store buffers, nothing guarantees that the writes
to break_lock are visible to other CPUs at any particular time.
- READ_ONCE/WRITE_ONCE are not used, so the field is potentially
susceptible to harmful compiler optimisations,
Consequently, the usefulness of this field is unclear and we'd be better off
removing it and allowing architectures to implement raw_spin_is_contended() by
providing a definition of arch_spin_is_contended(), as they can when
CONFIG_GENERIC_LOCKBREAK=n.
Signed-off-by: Will Deacon <will.deacon@arm.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Sebastian Ott <sebott@linux.vnet.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/1511894539-7988-3-git-send-email-will.deacon@arm.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'Documentation/locking')
0 files changed, 0 insertions, 0 deletions