[PATCH 5/9] rcu: Add rcutree.lazy_enabled boot parameter

From: Frederic Weisbecker
Date: Wed May 31 2023 - 06:18:20 EST


Allow to overwrite the arbitrary default number of lazy callbacks
threshold that is currently set to 100. This allows for tuning between
powersaving, throughtput and memory consumption expectations. As a
bonus, setting this value to 0 disables lazy callbacks.

Signed-off-by: Frederic Weisbecker <frederic@xxxxxxxxxx>
---
Documentation/admin-guide/kernel-parameters.txt | 5 +++++
kernel/rcu/tree.c | 3 ++-
2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 505978cfb548..dd2be4249061 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4798,6 +4798,11 @@
Set threshold of queued RCU callbacks beyond which
batch limiting is disabled.

+ rcutree.qhimark_lazy = [KNL]
+ Set threshold of queued lazy RCU callbacks beyond which
+ batch must be flushed to the main queue. If set to 0,
+ disable lazy queue.
+
rcutree.qlowmark= [KNL]
Set threshold of queued RCU callbacks below which
batch limiting is re-enabled.
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 9b98d87fa22e..e33c0d889216 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -390,6 +390,7 @@ static long qovld_calc = -1; // No pre-initialization lock acquisitions!

module_param(blimit, long, 0444);
module_param(qhimark, long, 0444);
+module_param(qhimark_lazy, long, 0444);
module_param(qlowmark, long, 0444);
module_param(qovld, long, 0444);

@@ -2655,7 +2656,7 @@ __call_rcu_common(struct rcu_head *head, rcu_callback_t func, bool lazy_in)
kasan_record_aux_stack_noalloc(head);
local_irq_save(flags);
rdp = this_cpu_ptr(&rcu_data);
- lazy = lazy_in && !rcu_async_should_hurry();
+ lazy = lazy_in && qhimark_lazy && !rcu_async_should_hurry();

/* Add the callback to our list. */
if (unlikely(!rcu_segcblist_is_enabled(&rdp->cblist))) {
--
2.40.1