Revisiting the kernel's preemption models (part 1)
Revisiting the kernel's preemption models (part 1)
Posted Sep 21, 2023 20:49 UTC (Thu) by geofft (subscriber, #59789)In reply to: Revisiting the kernel's preemption models (part 1) by mtodorov
Parent article: Revisiting the kernel's preemption models (part 1)
So you can't really convert this in a running system, because locks can be held at any time. You'd have to acquire the spinlock (which can block), then turn it into a sleeping lock, then figure out who's been spinning on the spinlock while you held it and somehow convert them. For a use case like going into battle, even if this were technically possible, having the mode switch require acquiring every lock in the system isn't acceptable because it could take indefinitely long. (And even if it weren't for this, there would be an ongoing performance cost in both modes in order to support checking what mode you're in and so forth, meaning that performance will never be as good as a pure real-time or pure non-real-time kernel.)
Posted Sep 21, 2023 21:26 UTC (Thu)
by mtodorov (guest, #158788)
[Link]
The locks which are currently held in a non-preemptible mode are obviously going to be held, but the idea behind locking is that it is short-held for performance reasons anyway.
I recall the kernel NMI timeouts on i.e. RCU locks being held for 20 seconds, but IMHO that is a sign of something deeply wrong in the kernel code ...
However, I have given up the idea that I will ever understand fully how +32M lines of code work and inter-operate.
Spinlocks are the idea of waiting from 6502 and Z80 and I think they're evil.
Revisiting the kernel's preemption models (part 1)