Re: Spinlock on single-processor machines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/26/06, s prashant <sprashant16@xxxxxxxxx> wrote:
On 7/26/06, Om. <om.turyx@xxxxxxxxx> wrote:

> On 7/25/06, Grob Team <grobteam@xxxxxxxxx> wrote:
> > On 7/25/06, s prashant <sprashant16@xxxxxxxxx> wrote:
> > > On 7/25/06, Gaurav Dhiman < gauravd.chd@xxxxxxxxx> wrote:
> > >
> > > > May I know where you read this. It does not seems ok to me.
> > > > I agree with your view point.
> > > >
> > > > Gaurav
> > > There are quite a few variants of spin locks.
> > > 1.spin_lock
> > >   spin_unlock
> > >
> > >  The above ones are used when you know the critical section that
> > >  you are protecting will not accessed from an interrupt handler.
> > >  In case of uniprocessor  m/c  these locks are not effective as they
> > >  compile away to nothing.
> > >
> > > 2.spin_lock_irqsave
> > >   spin_unlock_irqrestore
> > >  These locks also disable the interrrupts.
> I agree with you that there are multiple types of spin locks and
<snip>
 hi om,

here is a  snap shot of spin_lock macro in 2.6 kernel
 #define spin_lock(lock) \
 do { \
         preempt_disable(); \
         if (unlikely(!_raw_spin_trylock(lock))) \
                 __preempt_spin_lock(lock); \
 } while (0)

 in the above the irq_disable is not called. The local interrupts
I apologize for the wrong comments. What Grob Team replied in his mail
is _correct_.
I overlooked some parts of Documentation/spin_lock.txt. It clearly
states what Grob said in his mail.
Sorry again for any misinformation that I caused to spread.

spin_locks() are used when one is sure that the critical section is
not accessed from an interrupt handler. Otherwise spin_lock_irqsave()
and variants to be used.

Om

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux