[PATCH] define have_arch_cmpxchg()

Mathieu Desnoyers
2007-08-22T15:00:53Z

define have_arch_cmpxchg()

* Christoph Lameter (clameter@sgi.com) wrote:
> If we really want to do this then the implementation of all of these
> components need to result in competitive performance on all platforms.
>
Here is the first of 2 proposed patches to keep the same performances on
architectures that does not implement cmpxchg_local.

Add have_arch_cmpxchg(), which can be used within the body of functions to
select between irq disable and local_cmpxchg.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
include/linux/hardirq.h | 6 ++++++
1 file changed, 6 insertions(+)

Index: slab/include/linux/hardirq.h
===================================================================
--- slab.orig/include/linux/hardirq.h 2007-08-22 10:27:07.000000000 -0400
+++ slab/include/linux/hardirq.h 2007-08-22 10:27:46.000000000 -0400
@@ -149,4 +149,10 @@ extern void irq_exit(void);
#define nmi_enter() do { lockdep_off(); __irq_enter(); } while (0)
#define nmi_exit() do { __irq_exit(); lockdep_on(); } while (0)

+#ifdef __HAVE_ARCH_CMPXCHG
+#define have_arch_cmpxchg() 1
+#else
+#define have_arch_cmpxchg() 0
+#endif
+
#endif /* LINUX_HARDIRQ_H */