History

arch: Prepare for smp_mb__{before,after}_atomic()

Since the smp_mb__{before,after}*() ops are fundamentally dependent on how an arch can implement atomics it doesn't make sense to have 3 variants of them. They must all be the same. Furthermore, the 3 variants suggest they're only valid for those 3 atomic ops, while we have many more where they could be applied. So move away from smp_mb__{before,after}_{atomic,clear}_{dec,inc,bit}() and reduce the interface to just the two: smp_mb__{before,after}_atomic(). This patch prepares the way by introducing default implementations in asm-generic/barrier.h that default to a full barrier and providing __deprecated inlines for the previous 6 barriers if they're not provided by the arch. This should allow for a mostly painless transition (lots of deprecated warns in the interim).

Peter Zijlstra committed 12 years ago

Commit febdbfe1 parent 2ab08ee6 files · +82 −14Browse files

Showing the changes to include/linux/bitops.h (1 of 6 files). Show all

Unified · Split

include/linux/bitops.h+20−0
@@ -32,6 +32,26 @@ extern unsigned long __sw_hweight64(__u64 w); · 31 unmodified lines
3232 */
3333 #include <asm/bitops.h>
3434
35+/*
36+ * Provide __deprecated wrappers for the new interface, avoid flag day changes.
37+ * We need the ugly external functions to break header recursion hell.
38+ */
39+#ifndef smp_mb__before_clear_bit
40+static inline void __deprecated smp_mb__before_clear_bit(void)
41+{
42+ extern void __smp_mb__before_atomic(void);
43+ __smp_mb__before_atomic();
44+}
45+#endif
46+
47+#ifndef smp_mb__after_clear_bit
48+static inline void __deprecated smp_mb__after_clear_bit(void)
49+{
50+ extern void __smp_mb__after_atomic(void);
51+ __smp_mb__after_atomic();
52+}
53+#endif
54+
3555 #define for_each_set_bit(bit, addr, size) \
3656 for ((bit) = find_first_bit((addr), (size)); \
3757 (bit) < (size); \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t