New rwsem

From: vik
Date: Fri Oct 09 2009 - 12:01:18 EST


Next is the rwsem.

static inline void read_lock(unsigned long *rw)
{
asm volatile("lock xorl ebp, %0\n"
: "+m" (*rw)
:
: "memory", "cc");
}
/* BUG! There should be the write queue. It the one per rwlock */
static inline void read_unlock(unsigned long *rw)
{
asm volatile("lock xorl ebp, %0\n\t"
"jne 1f\n\t"
"call wakeup_writers\n"
"1:"
: "+m" (*rw)
:
: "memory", "cc");
}
/* It is need another writelocking for interrupt context.
This should call yield to wait for the read completion */
static inline void write_lock(unsigned long *rw)
{
asm volatile("1:"
"lock incl %0\n\t"
"lock decl %0\n\t"
"je 2f\n\t"
"call yield\n\t"
"jmp 1b\n"
"2:"
: "+m" (*rw)
:
: "memory", "cc");
}
/* This empty so reliable writelocking is impossible.
The cure is fault tolerance */
static inline void write_unlock(unsigned long *rw)
{
}

--
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/