linux/kernel/rcu
Paul E. McKenney 68d124b099 rcu: Add rcutree.nohz_full_patience_delay to reduce nohz_full OS jitter
If a CPU is running either a userspace application or a guest OS in
nohz_full mode, it is possible for a system call to occur just as an
RCU grace period is starting.  If that CPU also has the scheduling-clock
tick enabled for any reason (such as a second runnable task), and if the
system was booted with rcutree.use_softirq=0, then RCU can add insult to
injury by awakening that CPU's rcuc kthread, resulting in yet another
task and yet more OS jitter due to switching to that task, running it,
and switching back.

In addition, in the common case where that system call is not of
excessively long duration, awakening the rcuc task is pointless.
This pointlessness is due to the fact that the CPU will enter an extended
quiescent state upon returning to the userspace application or guest OS.
In this case, the rcuc kthread cannot do anything that the main RCU
grace-period kthread cannot do on its behalf, at least if it is given
a few additional milliseconds (for example, given the time duration
specified by rcutree.jiffies_till_first_fqs, give or take scheduling
delays).

This commit therefore adds a rcutree.nohz_full_patience_delay kernel
boot parameter that specifies the grace period age (in milliseconds,
rounded to jiffies) before which RCU will refrain from awakening the
rcuc kthread.  Preliminary experimentation suggests a value of 1000,
that is, one second.  Increasing rcutree.nohz_full_patience_delay will
increase grace-period latency and in turn increase memory footprint,
so systems with constrained memory might choose a smaller value.
Systems with less-aggressive OS-jitter requirements might choose the
default value of zero, which keeps the traditional immediate-wakeup
behavior, thus avoiding increases in grace-period latency.

[ paulmck: Apply Leonardo Bras feedback.  ]

Link: https://lore.kernel.org/all/20240328171949.743211-1-leobras@redhat.com/

Reported-by: Leonardo Bras <leobras@redhat.com>
Suggested-by: Leonardo Bras <leobras@redhat.com>
Suggested-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Leonardo Bras <leobras@redhat.com>
2024-07-04 13:47:39 -07:00
..
Kconfig rcu: Create NEED_TASKS_RCU to factor out enablement logic 2024-04-15 11:29:48 +02:00
Kconfig.debug rcu: Restrict access to RCU CPU stall notifiers 2023-12-12 02:31:22 +05:30
Makefile rcuperf: Change rcuperf to rcuscale 2020-08-24 18:39:24 -07:00
rcu_segcblist.c rcu: Use rcu_segcblist_segempty() instead of open coding it 2023-10-04 17:33:18 +02:00
rcu_segcblist.h rcu: Throttle callback invocation based on number of ready callbacks 2023-01-03 17:28:34 -08:00
rcu.h rcutorture: Make rcutorture support print rcu-tasks gp state 2024-04-16 11:16:35 +02:00
rcuscale.c rcu: Rename jiffies_till_flush to jiffies_lazy_flush 2024-02-14 08:00:57 -08:00
rcutorture.c rcutorture: Use rcu_gp_slow_register/unregister() only for rcutype test 2024-04-16 11:16:36 +02:00
refscale.c refscale: Print out additional module parameters 2023-09-11 23:02:18 +02:00
srcutiny.c srcu: Make Tiny SRCU explicitly disable preemption 2024-04-15 11:29:48 +02:00
srcutree.c srcu: Disable interrupts directly in srcu_gp_end() 2024-06-18 10:00:48 -07:00
sync.c rcu: Mark writes to rcu_sync ->gp_count field 2024-04-15 16:28:46 +02:00
tasks.h Merge branches 'fixes.2024.04.15a', 'misc.2024.04.12a', 'rcu-sync-normal-improve.2024.04.15a', 'rcu-tasks.2024.04.15a' and 'rcutorture.2024.04.15a' into rcu-merge.2024.04.15a 2024-05-01 13:04:02 +02:00
tiny.c rcu: Make Tiny RCU explicitly disable preemption 2024-04-15 11:29:48 +02:00
tree_exp.h rcu: Reduce synchronize_rcu() latency 2024-04-15 19:47:49 +02:00
tree_nocb.h Merge branches 'rcu-doc.2024.02.14a', 'rcu-nocb.2024.02.14a', 'rcu-exp.2024.02.14a', 'rcu-tasks.2024.02.26a' and 'rcu-misc.2024.02.14a' into rcu.2024.02.26a 2024-02-26 17:37:25 -08:00
tree_plugin.h rcu: Add rcutree.nohz_full_patience_delay to reduce nohz_full OS jitter 2024-07-04 13:47:39 -07:00
tree_stall.h rcu: Fix buffer overflow in print_cpu_stall_info() 2024-04-15 19:43:50 +02:00
tree.c rcu: Add rcutree.nohz_full_patience_delay to reduce nohz_full OS jitter 2024-07-04 13:47:39 -07:00
tree.h rcu/tree: Reduce wake up for synchronize_rcu() common case 2024-06-18 09:59:40 -07:00
update.c rcu-tasks: Make Tasks RCU wait idly for grace-period delays 2024-04-09 15:11:49 +02:00