Re: spin_lock_irq vs. spin_lock_irqsave.

From: Russell King (rmk@arm.linux.org.uk)
Date: Sat Jun 17 2000 - 09:42:14 EST


Daniel Kobras writes:
> I'd like to know the terms under which saving and restoring processor
> flags can be omitted? In other words, how can I determine if I have to use
> spin_lock_irqsave or if spin_lock_irq is sufficient? I had a look into
> Documentation/spinlocks.txt, but unfortunately the _irq/_bh variants
> aren't even mentioned.

Basically, if you can guarantee that at the point when spin_lock_irq()
is called, interrupts will always be enabled, then you can use
spin_lock_irq() instead of spin_lock_irqsave().

The reason for this is that you know that interrupts were enabled, so
when you come out of your critical region, you can just re-enable them
with spin_unlock_irq().
   _____
  |_____| ------------------------------------------------- ---+---+-
  | | Russell King rmk@arm.linux.org.uk --- ---
  | | | | http://www.arm.linux.org.uk/~rmk/aboutme.html / / |
  | +-+-+ --- -+-
  / | THE developer of ARM Linux |+| /|\
 / | | | --- |
    +-+-+ ------------------------------------------------- /\\\ |

-
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 : Fri Jun 23 2000 - 21:00:14 EST