Re: down_trylock doesn't preserve irqstate

From: Rajagopal Ananthanarayanan (ananth@sgi.com)
Date: Fri Feb 25 2000 - 18:33:47 EST


"David S. Miller" wrote:
>
> Date: Fri, 25 Feb 2000 15:11:38 -0800
> From: Rajagopal Ananthanarayanan <ananth@sgi.com>
>
> Right, if it were a sleep point, I agree.
> But my understanding is that down_trylock()
> is not one of those: isn't it used for conditionally
> acquiring the semaphore?
>
> True, sorry, thinko.
>
> But still, my other point holds, you should not IRQ disable
> when performing semaphore operations.
>

Sorry for being thick-headed about this; its been a while
since my OS 101 ;-).

You only said, to quote your first message:

        You should not acquire a semaphore with interrupts disabled.

Why not?

As far as I can see, the only problem is if the interrupt
is "locked" out trying to acquire the semaphore. This can't
happen since interrupts are disabled. But this line of
thought is probably not what you had in mind, since no
matter what code has the semaphore (interrupts disabled or
not), an interrupt should not be locked out trying to
acquire a semaphore unconditionally.

regards,

ananth.

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



This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:14 EST