Re: adding to wait queue

Ingo Molnar (mingo@chiara.csoma.elte.hu)
Mon, 7 Jun 1999 23:56:23 +0200 (CEST)


On Mon, 7 Jun 1999, Raj, Ashok wrote:

> Have a silly question.
>
> when i add to wait_queue() should i need a spinlock around it in a MP
> system? or
> would doing a
>
> save_flags(); cli() before doing a add_wait_queue() be sufficient.

add_wait_queue()/remove_wait_queue() functions are MP-safe. So for the
'typical' case where the waitqueue is on the local kernel stack you need
no locking at all. The generic rule is that typically all kernel services
are MP-safe (get_free_pages(), kmalloc(), slab, signal sending, etc.)

[in some cases we use __add_waitqueue which is a non-spinlock version, in
that case we have to make sure to hold the spinlock - the majority of uses
doesnt have to do this]

-- mingo

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/