[Devel] [RFC PATCH vz9 v6 21/62] dm-ploop: introduce per-md page locking

Alexander Atanasov alexander.atanasov at virtuozzo.com
Wed Jan 15 17:15:30 MSK 2025


On 13.01.25 13:22, Pavel Tikhomirov wrote:

For the history - this is not a rule of thumb but how lock variants work.

> - lock with no prefix should be used in interrupt context,

Interrupts are disabled for sure

> - lock with _irq prefix should be used in non-interrupt context,

Lock and disable interrupts

> - lock with _irqsave prefix should be used in places where both 
> interrupt and non-interrupt context are possible.

Lock and disable interrupts saving the state , so it can be restored
where state can be interrupts enabled or interrupts disabled. (flags 
contain more than interrupts state since they are cpu flags)

Holding a lock for a long period is not good since interrupts stay 
disabled - which can result in delays everywhere (from hardware level up 
to GUIs), preemption helps with this to an extent. So it is not only 
lock contention that is in the equation of why data must be locked and 
not code.

In layman terms - makes the mouse more responsive.

-- 
Regards,
Alexander Atanasov



More information about the Devel mailing list