Add full memory fence for test_and_*_bit operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



OK, semi-big-hammer to enforce full memory fence on ia64 for
test_and_set_bit
test_and_clear_bit
test_and_change_bit

It's sad we don't have something like:

test_and_set_bit_used_like_a_lock
test_and_set_bit_used_like_an_unlock
test_and_set_bit_full_memory_fence
test_and_clear_bit_used_like_a_lock
test_and_clear_bit_used_like_an_unlock
test_and_clear_bit_full_memory_fence
test_and_change_bit_used_like_a_lock
test_and_change_bit_used_like_an_unlock
test_and_change_bit_full_memory_fence

- Ken


Signed-off-by: Ken Chen <kenneth.w.chen@xxxxxxxxx>

--- ./include/asm-ia64/bitops.h.orig	2006-03-28 17:30:33.000000000 -0800
+++ ./include/asm-ia64/bitops.h	2006-03-28 17:31:30.000000000 -0800
@@ -166,7 +166,7 @@ test_and_set_bit (int nr, volatile void 
 		CMPXCHG_BUGCHECK(m);
 		old = *m;
 		new = old | bit;
-	} while (cmpxchg_acq(m, old, new) != old);
+	} while (cmpxchg_rel(m, old, new) != old);
 	return (old & bit) != 0;
 }
 
@@ -211,7 +211,7 @@ test_and_clear_bit (int nr, volatile voi
 		CMPXCHG_BUGCHECK(m);
 		old = *m;
 		new = old & mask;
-	} while (cmpxchg_acq(m, old, new) != old);
+	} while (cmpxchg_rel(m, old, new) != old);
 	return (old & ~mask) != 0;
 }
 
@@ -256,7 +256,7 @@ test_and_change_bit (int nr, volatile vo
 		CMPXCHG_BUGCHECK(m);
 		old = *m;
 		new = old ^ bit;
-	} while (cmpxchg_acq(m, old, new) != old);
+	} while (cmpxchg_rel(m, old, new) != old);
 	return (old & bit) != 0;
 }
 
-
: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Sparc Linux]     [DCCP]     [Linux ARM]     [Yosemite News]     [Linux SCSI]     [Linux x86_64]     [Linux for Ham Radio]

  Powered by Linux