The kernel is not preemptible???? What are you smoking? On Tue, 7 Nov 2023, Ankur Arora wrote:
In voluntary models, the scheduler's job is to match the demand side of preemption points (a task that needs to be scheduled) with the supply side (a task which calls cond_resched().)
Voluntary preemption models are important for code optimization because the code can rely on the scheduler not changing the cpu we are running on. This allows removing code for preempt_enable/disable to be removed from the code and allows better code generation. The best performing code is generated with defined preemption points when we have a guarantee that the code is not being rescheduled on a different processor. This is f.e. important for consistent access to PER CPU areas.
To do this add a new flag, TIF_NEED_RESCHED_LAZY which allows the scheduler to mark that a reschedule is needed, but is deferred until the task finishes executing in the kernel -- voluntary preemption as it were.
That is different from the current no preemption model? Seems to be the same.
There's just one remaining issue: now that explicit preemption points are gone, processes that spread a long time in the kernel have no way to give up the CPU.
These are needed to avoid adding preempt_enable/disable to a lot of primitives that are used for synchronization. You cannot remove those without changing a lot of synchronization primitives to always have to consider being preempted while operating.