On Fri, 04 Oct 2002, Andi Kleen wrote:
> On Fri, Oct 04, 2002 at 07:11:06AM -0600, Brian F. G. Bidulock wrote:
> > read_lock and write_lock are a rw semaphores, aren't they?
>
> No, they are read/write spinlocks and you are not allowed to sleep
> in their critical section In general you should limit them
> because they can get very costly, e.g. when you're taking interrupts
> with one taken or doing something else which takes a long time
> and another CPU has to spin for them.
Well, for LiS, a process does not sleep on read_lock whenever write_lock
might be called. This is because only invalid getpmsg/putpmsg calls
(wrong file descriptor) can be made during module loading and unloading.
No valid file descriptors exist for getpmsg/putpmsg when the module is
unloading (proper use of MOD_INC/DEC_USE_COUNT). I don't see that it
matters that a process sleeps holding a read_lock() when it is a given
that the write_lock() will never be attempted while the holder of the
read_lock() is sleeping.
--brian
-- Brian F. G. Bidulock ¦ The reasonable man adapts himself to the ¦ bidulock@openss7.org ¦ world; the unreasonable one persists in ¦ http://www.openss7.org/ ¦ trying to adapt the world to himself. ¦ ¦ Therefore all progress depends on the ¦ ¦ unreasonable man. -- George Bernard Shaw ¦ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/