Skip to contentSkip to conversation

2.6.3 _raw_write_trylock and __down_write_trylock

DISCUSSION Keith Owens 2 participants 2 messages Feb 23, 2004

lore
Share & tools
lore
#0 lore raw

2.6.3 defines include/asm-ia64/spinlock.h::_raw_write_trylock (both asm and C versions) and include/asm-ia64/rwsem.h::__down_write_trylock.

The C version of _raw_write_trylock is functionally identical to __down_write_trylock, but the code is completely different. Why have two implementations with such radically different code for the same feature? Why have both a C and asm version of _raw_write_trylock when the C version will work everywhere?

#1 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Keith Owens

Keith> 2.6.3 defines include/asm-ia64/spinlock.h::_raw_write_trylock Keith> (both asm and C versions) and
Keith> include/asm-ia64/rwsem.h::__down_write_trylock.

Keith> The C version of _raw_write_trylock is functionally identical Keith> to __down_write_trylock, but the code is completely Keith> different. Why have two implementations with such radically Keith> different code for the same feature? Why have both a C and Keith> asm version of _raw_write_trylock when the C version will Keith> work everywhere?

rwsem.h implements read-write semaphores, spinlock.h implements read-write spinlocks.

GCC doesn't schedule the C code for _raw_write_lock() well, hence the explicit ASM-version.

	--david