Lazy Preemption "PREEMPT_LAZY" Slated To Land In Linux 6.13
Yet another exciting feature expected to be merged for the upcoming Linux 6.13 cycle is the introduction of the Lazy Preemption model.
The patches for introducing the Lazy Preemption "PREEMPT_LAZY" mode were queued up yesterday into tip/tip.git's "sched/core" Git branch. With the lazy preemption patches working their way into a TIP branch, they should be submitted for the Linux 6.13 merge window opening up later this month.
Linux developer Peter Zijlstra explains in the patch adding the Lazy Preemption model:
The Kconfig option for introducing this new option is PREEMPT_LAZY. The PREEMPT_LAZY Kconfig text sums up this new preemption mode as:
When in patch form on the mailing list, Peter also had a patch introducing the "Laziest" preemption mode too, but that wasn't picked up into sched/core but just aiming for the more robust Lazy Preemption path.
The patches go on to enable PREEMPT_LAZY for x86/x86_64 and RISC-V architectures so far. This PREEMPT_LAZY addition comes just one kernel release after real-time "PREEMPT_RT" finally made it mainline for Linux 6.12.
The patches for introducing the Lazy Preemption "PREEMPT_LAZY" mode were queued up yesterday into tip/tip.git's "sched/core" Git branch. With the lazy preemption patches working their way into a TIP branch, they should be submitted for the Linux 6.13 merge window opening up later this month.
Linux developer Peter Zijlstra explains in the patch adding the Lazy Preemption model:
"sched: Add Lazy preemption model
Change fair to use resched_curr_lazy(), which, when the lazy preemption model is selected, will set TIF_NEED_RESCHED_LAZY.
This LAZY bit will be promoted to the full NEED_RESCHED bit on tick. As such, the average delay between setting LAZY and actually rescheduling will be TICK_NSEC/2.
In short, Lazy preemption will delay preemption for fair class but will function as Full preemption for all the other classes, most notably the realtime (RR/FIFO/DEADLINE) classes.
The goal is to bridge the performance gap with Voluntary, such that we might eventually remove that option entirely."
The Kconfig option for introducing this new option is PREEMPT_LAZY. The PREEMPT_LAZY Kconfig text sums up this new preemption mode as:
"This option provides a scheduler driven preemption model that is fundamentally similar to full preemption, but is less eager to preempt SCHED_NORMAL tasks in an attempt to reduce lock holder preemption and recover some of the performance gains seen from using Voluntary preemption."
When in patch form on the mailing list, Peter also had a patch introducing the "Laziest" preemption mode too, but that wasn't picked up into sched/core but just aiming for the more robust Lazy Preemption path.
The patches go on to enable PREEMPT_LAZY for x86/x86_64 and RISC-V architectures so far. This PREEMPT_LAZY addition comes just one kernel release after real-time "PREEMPT_RT" finally made it mainline for Linux 6.12.
9 Comments