[<prev] [next>] [day] [month] [year] [list]
Message-ID: <45934521495c84b6a6cfbd8919d30877.squirrel@mail.chelnydom.ru>
Date: Fri, 9 Oct 2009 16:43:20 +0400
From: vik@...lnydom.ru
To: linux-kernel@...r.kernel.org
Subject: New rwsem
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists