public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 1/3] IA64: Slim down __clear_bit_unlock
@ 2007-11-21 22:58 akpm
  2007-11-22  8:40 ` Zoltan Menyhart
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: akpm @ 2007-11-21 22:58 UTC (permalink / raw)
  To: linux-ia64

From: Christoph Lameter <clameter@sgi.com>

__clear_bit_unlock does not need to perform atomic operations on the
variable.  Avoid a cmpxchg and simply do a store with release semantics. 
Add a barrier to be safe that the compiler does not do funky things.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Acked-by: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/asm-ia64/bitops.h |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff -puN include/asm-ia64/bitops.h~ia64-slim-down-__clear_bit_unlock include/asm-ia64/bitops.h
--- a/include/asm-ia64/bitops.h~ia64-slim-down-__clear_bit_unlock
+++ a/include/asm-ia64/bitops.h
@@ -124,10 +124,21 @@ clear_bit_unlock (int nr, volatile void 
 /**
  * __clear_bit_unlock - Non-atomically clear a bit with release
  *
- * This is like clear_bit_unlock, but the implementation may use a non-atomic
- * store (this one uses an atomic, however).
+ * This is like clear_bit_unlock, but the implementation uses a store
+ * with release semantics. See also __raw_spin_unlock().
  */
-#define __clear_bit_unlock clear_bit_unlock
+static __inline__ void
+__clear_bit_unlock(int nr, volatile void *addr)
+{
+	__u32 mask, new;
+	volatile __u32 *m;
+
+	m = (volatile __u32 *)addr + (nr >> 5);
+	mask = ~(1 << (nr & 31));
+	new = *m & mask;
+	barrier();
+	asm volatile ("st4.rel.nta [%0] = %1\n\t" :: "r"(m), "r"(new));
+}
 
 /**
  * __clear_bit - Clears a bit in memory (non-atomic version)
_

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-01-16  6:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-21 22:58 [patch 1/3] IA64: Slim down __clear_bit_unlock akpm
2007-11-22  8:40 ` Zoltan Menyhart
2007-12-13 23:58 ` akpm
2008-01-02  9:54 ` Zoltan Menyhart
2008-01-02 20:19 ` Christoph Lameter
2008-01-03 13:36 ` Zoltan Menyhart
2008-01-03 22:14 ` Luck, Tony
2008-01-11  2:02 ` Nick Piggin
2008-01-15 13:15 ` [patch 1/3] IA64: Slim down __clear_bit_unlock #2 Zoltan Menyhart
2008-01-16  6:26 ` Nick Piggin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox