[PATCH] define have_arch_cmpxchg()

From: Mathieu Desnoyers
Date: Wed Aug 22 2007 - 11:00:57 EST


define have_arch_cmpxchg()

* Christoph Lameter (clameter@xxxxxxx) 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@xxxxxxxxxx>
---
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 */

--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/