mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] rcu: Make call_rcu() lazy only when CONFIG_RCU_LAZY is enabled
@ 2022-10-19 23:38 Zqiang
  2022-10-19 23:52 ` Paul E. McKenney
  0 siblings, 1 reply; 3+ messages in thread
From: Zqiang @ 2022-10-19 23:38 UTC (permalink / raw)
  To: paulmck, frederic, joel; +Cc: rcu, linux-kernel

Currently, regardless of whether the CONFIG_RCU_LAZY is enabled,
invoke the call_rcu() is always lazy, it also means that when
CONFIG_RCU_LAZY is disabled, invoke the call_rcu_flush() is also
lazy. therefore, this commit make call_rcu() lazy only when
CONFIG_RCU_LAZY is enabled.

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 v1->v2: 
 Use IS_ENABLED(CONFIG_RCU_LAZY) to the existing function of the same name.

 kernel/rcu/tree.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index abc615808b6e..ecf42b0d3726 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2887,7 +2887,10 @@ EXPORT_SYMBOL_GPL(call_rcu_flush);
  */
 void call_rcu(struct rcu_head *head, rcu_callback_t func)
 {
-	return __call_rcu_common(head, func, true);
+	if (IS_ENABLED(CONFIG_RCU_LAZY))
+		return __call_rcu_common(head, func, true);
+	else
+		return __call_rcu_common(head, func, false);
 }
 EXPORT_SYMBOL_GPL(call_rcu);
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] rcu: Make call_rcu() lazy only when CONFIG_RCU_LAZY is enabled
  2022-10-19 23:38 [PATCH v2] rcu: Make call_rcu() lazy only when CONFIG_RCU_LAZY is enabled Zqiang
@ 2022-10-19 23:52 ` Paul E. McKenney
  2022-10-20  0:49   ` Zhang, Qiang1
  0 siblings, 1 reply; 3+ messages in thread
From: Paul E. McKenney @ 2022-10-19 23:52 UTC (permalink / raw)
  To: Zqiang; +Cc: frederic, joel, rcu, linux-kernel

On Thu, Oct 20, 2022 at 07:38:35AM +0800, Zqiang wrote:
> Currently, regardless of whether the CONFIG_RCU_LAZY is enabled,
> invoke the call_rcu() is always lazy, it also means that when
> CONFIG_RCU_LAZY is disabled, invoke the call_rcu_flush() is also
> lazy. therefore, this commit make call_rcu() lazy only when
> CONFIG_RCU_LAZY is enabled.
> 
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> ---
>  v1->v2: 
>  Use IS_ENABLED(CONFIG_RCU_LAZY) to the existing function of the same name.
> 
>  kernel/rcu/tree.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index abc615808b6e..ecf42b0d3726 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2887,7 +2887,10 @@ EXPORT_SYMBOL_GPL(call_rcu_flush);
>   */
>  void call_rcu(struct rcu_head *head, rcu_callback_t func)
>  {
> -	return __call_rcu_common(head, func, true);
> +	if (IS_ENABLED(CONFIG_RCU_LAZY))
> +		return __call_rcu_common(head, func, true);
> +	else
> +		return __call_rcu_common(head, func, false);

This is much better, but why not something like this?

	return __call_rcu_common(head, func, IS_ENABLED(CONFIG_RCU_LAZY));

							Thanx, Paul

>  }
>  EXPORT_SYMBOL_GPL(call_rcu);
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH v2] rcu: Make call_rcu() lazy only when CONFIG_RCU_LAZY is enabled
  2022-10-19 23:52 ` Paul E. McKenney
@ 2022-10-20  0:49   ` Zhang, Qiang1
  0 siblings, 0 replies; 3+ messages in thread
From: Zhang, Qiang1 @ 2022-10-20  0:49 UTC (permalink / raw)
  To: paulmck; +Cc: frederic, joel, rcu, linux-kernel

On Thu, Oct 20, 2022 at 07:38:35AM +0800, Zqiang wrote:
> Currently, regardless of whether the CONFIG_RCU_LAZY is enabled,
> invoke the call_rcu() is always lazy, it also means that when
> CONFIG_RCU_LAZY is disabled, invoke the call_rcu_flush() is also
> lazy. therefore, this commit make call_rcu() lazy only when
> CONFIG_RCU_LAZY is enabled.
> 
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> ---
>  v1->v2: 
>  Use IS_ENABLED(CONFIG_RCU_LAZY) to the existing function of the same name.
> 
>  kernel/rcu/tree.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index abc615808b6e..ecf42b0d3726 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2887,7 +2887,10 @@ EXPORT_SYMBOL_GPL(call_rcu_flush);
>   */
>  void call_rcu(struct rcu_head *head, rcu_callback_t func)
>  {
> -	return __call_rcu_common(head, func, true);
> +	if (IS_ENABLED(CONFIG_RCU_LAZY))
> +		return __call_rcu_common(head, func, true);
> +	else
> +		return __call_rcu_common(head, func, false);

>
>This is much better, but why not something like this?

Yes, it looks better, 😊.

>
>	return __call_rcu_common(head, func, IS_ENABLED(CONFIG_RCU_LAZY));
>
>							Thanx, Paul

>  }
>  EXPORT_SYMBOL_GPL(call_rcu);
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-20  0:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-19 23:38 [PATCH v2] rcu: Make call_rcu() lazy only when CONFIG_RCU_LAZY is enabled Zqiang
2022-10-19 23:52 ` Paul E. McKenney
2022-10-20  0:49   ` Zhang, Qiang1

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®