Re: Semi up to date JOBS list

From: Manfred Spraul (
Date: Fri Jun 16 2000 - 07:41:55 EST

From: "Juan J. Quintela" <>
> 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
source around]

 * 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))
        return 0;
    return test_and_clear_bit(nr,addr);

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 Please read the FAQ at

This archive was generated by hypermail 2b29 : Fri Jun 23 2000 - 21:00:11 EST