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/