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().
That is true. However, for the purposes of this conversation it still doesn't matter. If interrupts are not disabled and an interrupt handler touches the data we are trying to protect, preempt_enable/disable won't help us. Right?
-- kr
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/