Re: [PATCH 1/5] bitops: add generic implementation of ext2 atomicbitops by test_and_{set,clear}_bit

From: Akinobu Mita
Date: Sun Oct 10 2010 - 11:07:48 EST


2010/10/8 Christoph Hellwig <hch@xxxxxxxxxxxxx>:
> On Fri, Oct 08, 2010 at 07:03:09PM +0900, Akinobu Mita wrote:
>> This introduces asm-generic header file for generic implementation of
>> ext2 atomic bit operations by test_and_set_bit() and test_and_clear_bit().
>>
>> alpha, arm, cris, frv, ia64, m68k, mn10300, parisc, powerpc, s390,
>> sparc64, x86, xtensa can use this header file in its asm/bitops.h.
>
> Care to rename the functions to le_* instead of ext2_* while you're at
> it and documenting their semantics?

OK, as several people requested in another threads, I'll introduce
little endian bit operations for all architectures and rename ext2
bitops to le bitops.

BTW, I have a question about ext2 atomic bit operations.

Some architectures use spinlock to implement it
(asm-generic/bitops/ext2-atomic.h). Most other architectures use
test_and_set_bit() and test_and_clear_bit() as this patch shows.

Why are there two implementations? test_and_{set,clear}_bit() are more
costly operations than spinlock for some architectures?
--
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/