Linux 6.1 Cleans Up More Code For PREEMPT_RT

Written by Michael Larabel in Linux Kernel on 5 October 2022 at 11:42 AM EDT. 1 Comment
LINUX KERNEL --
The real-time "RT" mainlining effort for the Linux kernel remains ongoing. While the finish line is coming near, PREEMPT_RT support for mainline still isn't over the last hurdle -- seemingly the main blocker it's still held up by are the printk changes with threaded console printing. But for the Linux 6.1 merge window there is at least more kernel code clean-ups.

Thomas Gleixner of Linutronix, which is owned by Intel since earlier this year, sent in a set of sched/rt patches this morning for Linux 6.1. For this cycle there are more PREEMPT_RT code clean-ups:
Introduce preempt_[dis|enable_nested() and use it to clean up various places which have open coded PREEMPT_RT conditionals.

On PREEMPT_RT enabled kernels, spinlocks and rwlocks are neither disabling preemption nor interrupts. Though there are a few places which depend on the implicit preemption/interrupt disable of those locks, e.g. seqcount write sections, per CPU statistics updates etc.

PREEMPT_RT added open coded CONFIG_PREEMPT_RT conditionals to disable/enable preemption in the related code parts all over the place. That's hard to read and does not really explain why this is necessary.

Linus suggested to use helper functions (preempt_disable_nested() and preempt_enable_nested()) and use those in the affected places. On !RT enabled kernels these functions are NOPs, but contain a lockdep assert to validate that preemption is actually disabled to catch call sites which do not have preemption disabled.

Clean up the affected code paths in mm, dentry and lib.

See this pull request for the full list of RT patches for Linux 6.1. Maybe by 6.2 the rest of the RT patch series will be ready for mainlining? It sure would make for a nice way of ringing in 2023.
Related News
About The Author
Author picture

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