Re: spin_lock or spin_lock_irqsave ?

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

 



Hello,

K.R. Foley wrote:

Someone feel free to correct me if I am wrong. Spinlocks only really provide useful protection in an SMP environment. In a uniprocessor environment spinlocks compile away to nothing because if a thread were spinning in a busy loop waiting to acquire a lock (spinlock) the thread holding the lock would never have a chance to release it. So by disabling (local) interrupts also, the code/data intended to be protected by the spinlock are protected for the duration of interrupts being disabled.

In which cases is it necessary to be protected only against other processors, and not against interrupt on the current processor ?


(In my understanding, spinlocks should always disable interrupts on the local processor, and do busy-waiting for other processors to release the spinlock).

Thomas
--
Thomas Petazzoni
thomas.petazzoni@xxxxxxxx

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