Messages in this thread | | | Date | Fri, 25 Feb 2000 15:11:38 -0800 | From | Rajagopal Ananthanarayanan <> | Subject | Re: down_trylock doesn't preserve irqstate |
| |
"David S. Miller" wrote: > > Date: Fri, 25 Feb 2000 14:37:13 -0800 > From: Rajagopal Ananthanarayanan <ananth@sgi.com> > > One problem we encountered in using down_trylock is that > __down_trylock() uses spin_lock_irq() and spin_unlock_irq(), which > does not preserve the interrupt state of the caller. > > You should not acquire a semaphore with interrupts disabled. > > And if the semaphore sleeps, you'll end up with IRQs enabled when it > wakes up. > > A few months ago we went scattering around fixing up places > which assumed IRQ state was preserved across sleep points, > let's not add new ones (and thus new bugs).
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? That is, if semaphore available, get the semaphore, otherwise don't bother? And a quick check reveals __down_trylock is used only in down_trylock path, not by down() variants which can sleep.
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/
| |