From: "Juan J. Quintela" <firstname.lastname@example.org>
> Could you elaborate please? I see no reference to TestAndTestAndSet
> in the code.
linux/include/asm-ia64/spinlock.h, 2.3.99-pre8 [I don't have the newest
* Streamlined test_and_set_bit(0, (x)). We use test-and-test-and-set
* rather than a simple xchg to avoid writing the cache-line when
* there is contention.
> The bit is supposed to be normally 0, but it depends of
> your workload. How do you write that function/macro????
int test_and_test_and_clear(int nr, unsigned long *addr)
if(!(addr & (1<<nr))
The idea is simple:
* if the bit is 0, then avoid the atomic operation.
* even the normal test_and_clear can't guarantee that the bit will be clear
when test_and_clear returns, it doesn't matter that we've enlarged that
* The main difference is that test_and_clear is a memory barrier, but
test_and_test_and_clear() is not.
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to email@example.com Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:11 EST