All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rcu: per-cpu rcuc kthread are created only when rcutree.use_softirq=0
@ 2021-12-28 16:05 Zqiang
  2022-01-01 16:44 ` Paul E. McKenney
  0 siblings, 1 reply; 5+ messages in thread
From: Zqiang @ 2021-12-28 16:05 UTC (permalink / raw)
  To: paulmck, frederic; +Cc: linux-kernel, qiang1.zhang

In non-RT kernel, if the RCU_BOOST is enabled, the per-cpu rcuc
kthread will be created, however under the rcutree.use_softirq=1,
the RCU core processing only in softirq context, the rcuc kthread
doesn't do anything, so remove RCU_BOOST interference.

Signed-off-by: Zqiang <qiang1.zhang@intel.com>
---
 kernel/rcu/tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index 9b58bae0527a..ed64b4fcb8a0 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2902,7 +2902,7 @@ static int __init rcu_spawn_core_kthreads(void)
 
 	for_each_possible_cpu(cpu)
 		per_cpu(rcu_data.rcu_cpu_has_work, cpu) = 0;
-	if (!IS_ENABLED(CONFIG_RCU_BOOST) && use_softirq)
+	if (use_softirq)
 		return 0;
 	WARN_ONCE(smpboot_register_percpu_thread(&rcu_cpu_thread_spec),
 		  "%s: Could not start rcuc kthread, OOM is now expected behavior\n", __func__);
-- 
2.25.1


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

* Re: [PATCH] rcu: per-cpu rcuc kthread are created only when rcutree.use_softirq=0
  2021-12-28 16:05 [PATCH] rcu: per-cpu rcuc kthread are created only when rcutree.use_softirq=0 Zqiang
@ 2022-01-01 16:44 ` Paul E. McKenney
  2022-01-03 13:17   ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 5+ messages in thread
From: Paul E. McKenney @ 2022-01-01 16:44 UTC (permalink / raw)
  To: Zqiang; +Cc: frederic, linux-kernel, bigeasy

On Wed, Dec 29, 2021 at 12:05:10AM +0800, Zqiang wrote:
> In non-RT kernel, if the RCU_BOOST is enabled, the per-cpu rcuc
> kthread will be created, however under the rcutree.use_softirq=1,
> the RCU core processing only in softirq context, the rcuc kthread
> doesn't do anything, so remove RCU_BOOST interference.
> 
> Signed-off-by: Zqiang <qiang1.zhang@intel.com>

Looks sane to me, but adding Sebastian on CC for his thoughts.

							Thanx, Paul

> ---
>  kernel/rcu/tree.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> index 9b58bae0527a..ed64b4fcb8a0 100644
> --- a/kernel/rcu/tree.c
> +++ b/kernel/rcu/tree.c
> @@ -2902,7 +2902,7 @@ static int __init rcu_spawn_core_kthreads(void)
>  
>  	for_each_possible_cpu(cpu)
>  		per_cpu(rcu_data.rcu_cpu_has_work, cpu) = 0;
> -	if (!IS_ENABLED(CONFIG_RCU_BOOST) && use_softirq)
> +	if (use_softirq)
>  		return 0;
>  	WARN_ONCE(smpboot_register_percpu_thread(&rcu_cpu_thread_spec),
>  		  "%s: Could not start rcuc kthread, OOM is now expected behavior\n", __func__);
> -- 
> 2.25.1
> 

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

* Re: [PATCH] rcu: per-cpu rcuc kthread are created only when rcutree.use_softirq=0
  2022-01-01 16:44 ` Paul E. McKenney
@ 2022-01-03 13:17   ` Sebastian Andrzej Siewior
  2022-01-03 14:34     ` Paul E. McKenney
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-01-03 13:17 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: Zqiang, frederic, linux-kernel

On 2022-01-01 08:44:26 [-0800], Paul E. McKenney wrote:
> On Wed, Dec 29, 2021 at 12:05:10AM +0800, Zqiang wrote:
> > In non-RT kernel, if the RCU_BOOST is enabled, the per-cpu rcuc
> > kthread will be created, however under the rcutree.use_softirq=1,
> > the RCU core processing only in softirq context, the rcuc kthread
> > doesn't do anything, so remove RCU_BOOST interference.
> > 
> > Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> 
> Looks sane to me, but adding Sebastian on CC for his thoughts.

Yes, it makes sense. invoke_rcu_core_kthread() is only invoked for
!use_softirq so it makes to create the threads based on this condition.

Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

> 							Thanx, Paul

Sebastian

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

* Re: [PATCH] rcu: per-cpu rcuc kthread are created only when rcutree.use_softirq=0
  2022-01-03 13:17   ` Sebastian Andrzej Siewior
@ 2022-01-03 14:34     ` Paul E. McKenney
  2022-01-04  8:38       ` Zhang, Qiang1
  0 siblings, 1 reply; 5+ messages in thread
From: Paul E. McKenney @ 2022-01-03 14:34 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior; +Cc: Zqiang, frederic, linux-kernel

On Mon, Jan 03, 2022 at 02:17:11PM +0100, Sebastian Andrzej Siewior wrote:
> On 2022-01-01 08:44:26 [-0800], Paul E. McKenney wrote:
> > On Wed, Dec 29, 2021 at 12:05:10AM +0800, Zqiang wrote:
> > > In non-RT kernel, if the RCU_BOOST is enabled, the per-cpu rcuc
> > > kthread will be created, however under the rcutree.use_softirq=1,
> > > the RCU core processing only in softirq context, the rcuc kthread
> > > doesn't do anything, so remove RCU_BOOST interference.
> > > 
> > > Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> > 
> > Looks sane to me, but adding Sebastian on CC for his thoughts.
> 
> Yes, it makes sense. invoke_rcu_core_kthread() is only invoked for
> !use_softirq so it makes to create the threads based on this condition.
> 
> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Thank you both!  As usual, I could not resist a bit of wordsmithing,
please see below.

							Thanx, Paul

------------------------------------------------------------------------

commit 6e68b781388cfaca95a07493a060c4a6e4ee5d0f
Author: Zqiang <qiang1.zhang@intel.com>
Date:   Wed Dec 29 00:05:10 2021 +0800

    rcu: Create per-cpu rcuc kthreads only when rcutree.use_softirq=0
    
    The per-CPU "rcuc" kthreads are used only by kernels booted with
    rcutree.use_softirq=0, but they are nevertheless unconditionally created
    by kernels built with CONFIG_RCU_BOOST=y.  This results in "rcuc"
    kthreads being created that are never actually used.  This commit
    therefore refrains from creating these kthreads unless the kernel
    is actually booted with rcutree.use_softirq=0.
    
    Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
    Signed-off-by: Zqiang <qiang1.zhang@intel.com>
    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index aeea5487632f7..5c0ffee7a43a0 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -2903,7 +2903,7 @@ static int __init rcu_spawn_core_kthreads(void)
 
 	for_each_possible_cpu(cpu)
 		per_cpu(rcu_data.rcu_cpu_has_work, cpu) = 0;
-	if (!IS_ENABLED(CONFIG_RCU_BOOST) && use_softirq)
+	if (use_softirq)
 		return 0;
 	WARN_ONCE(smpboot_register_percpu_thread(&rcu_cpu_thread_spec),
 		  "%s: Could not start rcuc kthread, OOM is now expected behavior\n", __func__);

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

* RE: [PATCH] rcu: per-cpu rcuc kthread are created only when rcutree.use_softirq=0
  2022-01-03 14:34     ` Paul E. McKenney
@ 2022-01-04  8:38       ` Zhang, Qiang1
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qiang1 @ 2022-01-04  8:38 UTC (permalink / raw)
  To: paulmck, Sebastian Andrzej Siewior; +Cc: frederic, linux-kernel


On Mon, Jan 03, 2022 at 02:17:11PM +0100, Sebastian Andrzej Siewior wrote:
> On 2022-01-01 08:44:26 [-0800], Paul E. McKenney wrote:
> > On Wed, Dec 29, 2021 at 12:05:10AM +0800, Zqiang wrote:
> > > In non-RT kernel, if the RCU_BOOST is enabled, the per-cpu rcuc 
> > > kthread will be created, however under the rcutree.use_softirq=1, 
> > > the RCU core processing only in softirq context, the rcuc kthread 
> > > doesn't do anything, so remove RCU_BOOST interference.
> > > 
> > > Signed-off-by: Zqiang <qiang1.zhang@intel.com>
> > 
> > Looks sane to me, but adding Sebastian on CC for his thoughts.
> 
> Yes, it makes sense. invoke_rcu_core_kthread() is only invoked for 
> !use_softirq so it makes to create the threads based on this condition.
> 
> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Thanks Sebastian review.

>Thank you both!  As usual, I could not resist a bit of wordsmithing, please see below.

Hi Paul , thank you for your modification, your description is clearer.

Thanks,
Zqiang

>
>							Thanx, Paul
>
>------------------------------------------------------------------------
>
>commit 6e68b781388cfaca95a07493a060c4a6e4ee5d0f
>Author: Zqiang <qiang1.zhang@intel.com>
>Date:   Wed Dec 29 00:05:10 2021 +0800
>
>    rcu: Create per-cpu rcuc kthreads only when rcutree.use_softirq=0
>    
>    The per-CPU "rcuc" kthreads are used only by kernels booted with
>    rcutree.use_softirq=0, but they are nevertheless unconditionally created
>    by kernels built with CONFIG_RCU_BOOST=y.  This results in "rcuc"
>    kthreads being created that are never actually used.  This commit
>    therefore refrains from creating these kthreads unless the kernel
>    is actually booted with rcutree.use_softirq=0.
    
>    Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
>    Signed-off-by: Zqiang <qiang1.zhang@intel.com>
>    Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
>
>diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index aeea5487632f7..5c0ffee7a43a0 100644
>--- a/kernel/rcu/tree.c
>+++ b/kernel/rcu/tree.c
>@@ -2903,7 +2903,7 @@ static int __init rcu_spawn_core_kthreads(void)
> 
> 	for_each_possible_cpu(cpu)
> 		per_cpu(rcu_data.rcu_cpu_has_work, cpu) = 0;
>-	if (!IS_ENABLED(CONFIG_RCU_BOOST) && use_softirq)
>+	if (use_softirq)
> 		return 0;
> 	WARN_ONCE(smpboot_register_percpu_thread(&rcu_cpu_thread_spec),
>		  "%s: Could not start rcuc kthread, OOM is now expected behavior\n", __func__);

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

end of thread, other threads:[~2022-01-04  8:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-28 16:05 [PATCH] rcu: per-cpu rcuc kthread are created only when rcutree.use_softirq=0 Zqiang
2022-01-01 16:44 ` Paul E. McKenney
2022-01-03 13:17   ` Sebastian Andrzej Siewior
2022-01-03 14:34     ` Paul E. McKenney
2022-01-04  8:38       ` Zhang, Qiang1

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.