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.
Only one remark - on UP with Preemption enabled spin_lock/spin_unlock are
preempt_enable()/preempt_disable().
--
Best Regards,
Artem B. Bityuckiy,
St.-Petersburg, Russia.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/