diff mbox series

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

Message ID 20230531101736.12981-6-frederic@kernel.org (mailing list archive)
State New, archived
Headers show
Series rcu: Support for lazy callbacks on !CONFIG_RCU_NOCB_CPU | expand

Commit Message

Frederic Weisbecker May 31, 2023, 10:17 a.m. UTC
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@kernel.org>
---
 Documentation/admin-guide/kernel-parameters.txt | 5 +++++
 kernel/rcu/tree.c                               | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Zhuo, Qiuxu June 13, 2023, 6:57 a.m. UTC | #1
> From: Frederic Weisbecker <frederic@kernel.org>
> Sent: Wednesday, May 31, 2023 6:18 PM
> ...
> Subject: [PATCH 5/9] rcu: Add rcutree.lazy_enabled boot parameter

I didn't find the 'lazy_enabled' variable in the patch series.
Did you say rcutree. qhimark_lazy?

-Qiuxu

> 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@kernel.org>
> ---
>  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
Frederic Weisbecker July 5, 2023, 12:42 p.m. UTC | #2
Le Tue, Jun 13, 2023 at 06:57:25AM +0000, Zhuo, Qiuxu a écrit :
> > From: Frederic Weisbecker <frederic@kernel.org>
> > Sent: Wednesday, May 31, 2023 6:18 PM
> > ...
> > Subject: [PATCH 5/9] rcu: Add rcutree.lazy_enabled boot parameter
> 
> I didn't find the 'lazy_enabled' variable in the patch series.
> Did you say rcutree. qhimark_lazy?

Indeed :-)

Thanks.
diff mbox series

Patch

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))) {