preemptible spinlock?

Wonhyuk Yang vvghjk1234 at gmail.com
Fri Apr 23 02:27:24 EDT 2021


Hi,

> I think the main idea spinlock disables preemption is,

> the other process that's spinning on the lock can acquire lock.



> but in some implementations of spinlock, like qspinlock in x86 (or mcs
lock),
> I think there's no need to disable preemption. because processes
> waiting for lock cannot acquire the lock before the lock holder hand
> over to other process.


Are you talking about disabling local irq(ex. spin_lock_irqsave)?

If so, think about the situation that a process holding the lock is
preempted

by interrupt. And that interrupt handler tries to grab the spinlock.

It will lead to deadlock.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20210423/c9bb2d35/attachment.html>


More information about the Kernelnewbies mailing list