Real-time updates for v5.12
Subsystems (2)
Paul E. McKenney
maintainercover Real-time updates for v5.12
Hello!
This series provides some real-time enhancements:
1. Make RCU_BOOST default on CONFIG_PREEMPT_RT, courtesy of Sebastian
Andrzej Siewior.
2. Unconditionally use rcuc threads on PREEMPT_RT, courtesy of
Scott Wood.
3. Enable rcu_normal_after_boot unconditionally for RT, courtesy
of Julia Cartwright.
Thanx, Paul
------------------------------------------------------------------------
Documentation/admin-guide/kernel-parameters.txt | 11 +++++++++++ kernel/rcu/Kconfig | 4 ++-- kernel/rcu/tree.c | 4 +++- kernel/rcu/update.c | 4 +++- 4 files changed, 19 insertions(+), 4 deletions(-)
[email protected]
maintainerPATCH 1/3 rcu: Make RCU_BOOST default on CONFIG_PREEMPT_RT
From: Sebastian Andrzej Siewior <[email protected]>
On PREEMPT_RT kernels, RCU callbacks are deferred to the `rcuc' kthread. This can stall RCU grace periods due to lengthy preemption not only of RCU readers but also of 'rcuc' kthreads, either of which prevent grace periods from completing, which can in turn result in OOM. Because PREEMPT_RT kernels have more kthreads that can block grace periods, it is more important for such kernels to enable RCU_BOOST.
This commit therefore makes RCU_BOOST the default on PREEMPT_RT. RCU_BOOST can still be manually disabled if need be.
--- kernel/rcu/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/rcu/Kconfig +2 -2
@@ -188,8 +188,8 @@ config RCU_FAST_NO_HZ config RCU_BOOST bool "Enable RCU priority boosting" - depends on RT_MUTEXES && PREEMPT_RCU && RCU_EXPERT - default n + depends on (RT_MUTEXES && PREEMPT_RCU && RCU_EXPERT) || PREEMPT_RT + default y if PREEMPT_RT help This option boosts the priority of preempted RCU readers that block the current preemptible RCU grace period for too long.
Signature · 1 line
2.9.5
[email protected]
maintainerPATCH 2/3 rcu: Unconditionally use rcuc threads on PREEMPT_RT
In reply to Paul E. McKenneyFrom: Scott Wood <[email protected]>
PREEMPT_RT systems have long used the rcutree.use_softirq kernel boot parameter to avoid use of RCU_SOFTIRQ handlers, which can disrupt real-time applications by invoking callbacks during return from interrupts that arrived while executing time-critical code. This kernel boot parameter instead runs RCU core processing in an 'rcuc' kthread, thus allowing the scheduler to do its job of avoiding disrupting time-critical code.
This commit therefore disables the rcutree.use_softirq kernel boot parameter on PREEMPT_RT systems, thus forcing such systems to do RCU core processing in 'rcuc' kthreads. This approach has long been in use by users of the -rt patchset, and there have been no complaints. There is therefore no way for the system administrator to override this choice, at least without modifying and rebuilding the kernel.
--- Documentation/admin-guide/kernel-parameters.txt | 4 ++++ kernel/rcu/tree.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-)
Documentation/admin-guide/kernel-parameters.txt +4 -0
@@ -4092,6 +4092,10 @@ value, meaning that RCU_SOFTIRQ is used by default. Specify rcutree.use_softirq=0 to use rcuc kthreads. + But note that CONFIG_PREEMPT_RT=y kernels disable + this kernel boot parameter, forcibly setting it + to zero. + rcutree.rcu_fanout_exact= [KNL] Disable autobalancing of the rcu_node combining tree. This is used by rcutorture, and might
kernel/rcu/tree.c +3 -1
@@ -100,8 +100,10 @@ static struct rcu_state rcu_state = {static bool dump_tree;module_param (dump_tree, bool,0444 );/* By default, use RCU_SOFTIRQ instead of rcuc kthreads. */ -static bool use_softirq = true; +static bool use_softirq = !IS_ENABLED (CONFIG_PREEMPT_RT ); +#ifndef CONFIG_PREEMPT_RT module_param (use_softirq, bool,0444 ); +#endif /* Control rcu_node-tree auto-balancing at boot time. */ static bool rcu_fanout_exact;module_param (rcu_fanout_exact, bool,0444 );
Signature · 1 line
2.9.5
[email protected]
maintainerPATCH 3/3 rcu: Enable rcu_normal_after_boot unconditionally for RT
In reply to Paul E. McKenneyFrom: Julia Cartwright <[email protected]>
Expedited RCU grace periods send IPIs to all non-idle CPUs, and thus can disrupt time-critical code in real-time applications. However, there is a portion of boot-time processing (presumably before any real-time applications have started) where expedited RCU grace periods are the only option. And so it is that experience with the -rt patchset indicates that PREEMPT_RT systems should always set the rcupdate.rcu_normal_after_boot kernel boot parameter.
This commit therefore makes the post-boot application environment safe for real-time applications by making PREEMPT_RT systems disable the rcupdate.rcu_normal_after_boot kernel boot parameter and acting as if this parameter had been set. This means that post-boot calls to synchronize_rcu_expedited() will be treated as if they were instead calls to synchronize_rcu(), thus preventing the IPIs, and thus avoiding disrupting real-time applications.
--- Documentation/admin-guide/kernel-parameters.txt | 7 +++++++ kernel/rcu/update.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-)
Documentation/admin-guide/kernel-parameters.txt +7 -0
@@ -4474,6 +4474,13 @@ only normal grace-period primitives. No effect on CONFIG_TINY_RCU kernels. + But note that CONFIG_PREEMPT_RT=y kernels enables + this kernel boot parameter, forcibly setting + it to the value one, that is, converting any + post-boot attempt at an expedited RCU grace + period to instead use normal non-expedited + grace-period processing. + rcupdate.rcu_task_ipi_delay= [KNL] Set time in jiffies during which RCU tasks will avoid sending IPIs, starting with the beginning
kernel/rcu/update.c +3 -1
@@ -56,8 +56,10 @@#ifndef CONFIG_TINY_RCU module_param (rcu_expedited, int,0 );module_param (rcu_normal, int,0 ); -static int rcu_normal_after_boot; +static int rcu_normal_after_boot =IS_ENABLED (CONFIG_PREEMPT_RT ); +#ifndef CONFIG_PREEMPT_RT module_param (rcu_normal_after_boot, int,0 ); +#endif #endif /* #ifndef CONFIG_TINY_RCU */ #ifdef CONFIG_DEBUG_LOCK_ALLOC
Signature · 1 line
2.9.5