On 9/14/05, linux lover <caprianking2002@xxxxxxxxx> wrote: > i have basic query > whats the difference between spin_lock, spin_lock_irq and spin_lock_irqsave > similarly corresponding unlock functions. > spin_lock ---------> is simply a lock, that is interrupts are enabled spin_lock_irq ----> is a lock with interrupts disabled and prev interrupts or interrupts state will lost spin_lock_irqsave ----> its disables interrupts but save them in the flags field and in unlocking it restores them ......... this is the safest to use lock ... > if we do seomthing like this : > spin_lock_irqsave(&q1, flag1); > > spin_lock_irqsave(&q2, flag2); > > spin_unlock_irqrestore(flag1); <------- here its nullifies the irqs saving > for second lock??? > > spin_unlock_irqrestore(flag2); Its a bad idea to use nested spin_lock_irqsave and then restoring them in the order they are acquired like restoring outer one and then inner one rather have to unlock them like first inner one and then outer one , by the way I hav't used spin_lock_irqsave in nested form so i might be wrong ..... I think you have to read "unreliable guide to locking" book for concepts ..... -- Fawad Lateef -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/