path: root/Documentation/atomic_ops.txt
diff options
authorNick Piggin <>2007-10-18 03:06:39 -0700
committerLinus Torvalds <>2007-10-18 14:37:29 -0700
commit26333576fd0d0b52f6e4025c5aded97e188bdd44 (patch)
treea9c1f9518d940a8ef10453871f2899ca18d46efa /Documentation/atomic_ops.txt
parent38048983e14c0fb6324175fbaf2be1baa842f5ee (diff)
bitops: introduce lock ops
Introduce test_and_set_bit_lock / clear_bit_unlock bitops with lock semantics. Convert all architectures to use the generic implementation. Signed-off-by: Nick Piggin <> Acked-By: David Howells <> Cc: Richard Henderson <> Cc: Ivan Kokshaysky <> Cc: Russell King <> Cc: Haavard Skinnemoen <> Cc: Bryan Wu <> Cc: Mikael Starvik <> Cc: David Howells <> Cc: Yoshinori Sato <> Cc: "Luck, Tony" <> Cc: Hirokazu Takata <> Cc: Geert Uytterhoeven <> Cc: Roman Zippel <> Cc: Greg Ungerer <> Cc: Ralf Baechle <> Cc: Kyle McMartin <> Cc: Matthew Wilcox <> Cc: Paul Mackerras <> Cc: Benjamin Herrenschmidt <> Cc: Heiko Carstens <> Cc: Martin Schwidefsky <> Cc: Paul Mundt <> Cc: Kazumoto Kojima <> Cc: Richard Curnow <> Cc: William Lee Irwin III <> Cc: "David S. Miller" <> Cc: Jeff Dike <> Cc: Paolo 'Blaisorblade' Giarrusso <> Cc: Miles Bader <> Cc: Andi Kleen <> Cc: Chris Zankel <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'Documentation/atomic_ops.txt')
1 files changed, 14 insertions, 0 deletions
diff --git a/Documentation/atomic_ops.txt b/Documentation/atomic_ops.txt
index d46306fea230..f20c10c2858f 100644
--- a/Documentation/atomic_ops.txt
+++ b/Documentation/atomic_ops.txt
@@ -418,6 +418,20 @@ brothers:
+There are two special bitops with lock barrier semantics (acquire/release,
+same as spinlocks). These operate in the same way as their non-_lock/unlock
+postfixed variants, except that they are to provide acquire/release semantics,
+respectively. This means they can be used for bit_spin_trylock and
+bit_spin_unlock type operations without specifying any more barriers.
+ int test_and_set_bit_lock(unsigned long nr, unsigned long *addr);
+ void clear_bit_unlock(unsigned long nr, unsigned long *addr);
+ void __clear_bit_unlock(unsigned long nr, unsigned long *addr);
+The __clear_bit_unlock version is non-atomic, however it still implements
+unlock barrier semantics. This can be useful if the lock itself is protecting
+the other bits in the word.
Finally, there are non-atomic versions of the bitmask operations
provided. They are used in contexts where some other higher-level SMP
locking scheme is being used to protect the bitmask, and thus less