Here's the RW semaphore patch again (rwsem2.diff) with a fallback to spinlocks if XADD/CMPXCHG aren't available. I've put the two implementations in separate headers as suggested. David