preemption disable in spin_lock

2010-01-17 Thread Joel Fernandes
Why is preemption disabled before a lock is acquired in _spin_lock function? As the critical region of code which is to be protected by the spin lock executes only after the lock is acquired, why is disabling of preemption required before the lock is acquired? Wouldn't it better if the kernel

Re: preemption disable in spin_lock

2010-01-17 Thread Joel Fernandes
Thanks for your message. Also adding to that, I think it doesn't matter because spinlocks are supposed to held for a short period. -Joel On Sun, Jan 17, 2010 at 10:13 PM, Mulyadi Santosa mulyadi.sant...@gmail.com wrote: Hi Joel... On Sun, Jan 17, 2010 at 9:34 PM, Joel Fernandes

Re: preemption disable in spin_lock

2010-01-17 Thread Mulyadi Santosa
Hi Joel... On Sun, Jan 17, 2010 at 9:34 PM, Joel Fernandes agnel.j...@gmail.com wrote: Why is preemption disabled before a lock is acquired in _spin_lock function? As the critical region of code which is to be protected by the spin lock executes only after the lock is acquired, why is

Re: preemption disable in spin_lock

2010-01-17 Thread Peter Teoh
On Sun, Jan 17, 2010 at 10:34 PM, Joel Fernandes agnel.j...@gmail.com wrote: Why is preemption disabled before a lock is acquired in _spin_lock function? theoretically, if your interrupt handling codes is sharing some data with your kernel codes, then assuming u have one CPU, it is possible