Dynamic Preemption Support Sent In For The Linux 5.12 Kernel

Written by Michael Larabel in Linux Kernel on 17 February 2021 at 10:26 AM EST. 8 Comments
LINUX KERNEL
Ingo Molnar sent in the scheduler updates for Linux 5.12 today and it includes some notable additions, including PREEMPT_DYNAMIC, which allows changing the kernel's preemption mode at boot/run-time.

The CONFIG_PREEMPT_DYNAMIC option when enabled allows setting preempt= at boot time to either none/voluntary/full with full preemption being the default. Distributions can still set the standard PREEMPT controls but this dynamic option allows changing it at boot time without rebuilding the kernel or even at run-time via a DebugFS interface. The kernel relies on runtime patching for changing the kernel preemption mode on the fly.

The PREEMPT_DYNAMIC Kconfig help text explains:
This option allows to define the preemption model on the kernel command line parameter and thus override the default preemption model defined during compile time.

The feature is primarily interesting for Linux distributions which provide a pre-built kernel binary to reduce the number of kernel flavors they offer while still offering different usecases. The runtime overhead is negligible with HAVE_STATIC_CALL_INLINE enabled but if runtime patching is not available for the specific architecture then the potential overhead should be considered.

Interesting if you want the same pre-built kernel should be used for both Server and Desktop workloads.

In addition to the dynamic preemption handling, the scheduler update also has improvements around SMP/NUMA load balancing. In particular, scanning for an idle sibling is now done in a single pass with better logic than prior kernels.

This pull also has improved the CPUFreq cooling driver by getting the effective CPU utilization metrics from the scheduler, improved the fair scheduler's active load balancing logic, and other improvements.

See this pull request for details. I'll be running some benchmarks on the Linux 5.12 Git state in the coming days.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week