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.santosa@xxxxxxxxx> wrote: > Hi Joel... > > On Sun, Jan 17, 2010 at 9:34 PM, Joel Fernandes <agnel.joel@xxxxxxxxx> 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 disabling of >> preemption required before the lock is acquired? >> >> Wouldn't it better if the kernel code that does the spinning before >> the lock is acquired is itself preempted so that someone else can run >> in the meanwhile? > > IMO that exactly what spinlock tries to avoid: to schedule out, hence > the word: "spin". Thus at the first moment possible, it grabs the > lock... > > -- > regards, > > Mulyadi Santosa > Freelance Linux trainer and consultant > > blog: the-hydra.blogspot.com > training: mulyaditraining.blogspot.com > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ