rcu.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Uladzislau Rezki <urezki@gmail.com>
To: Joel Fernandes <joelagnelf@nvidia.com>
Cc: "Uladzislau Rezki (Sony)" <urezki@gmail.com>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	Joel Fernandes <joel@joelfernandes.org>,
	Neeraj upadhyay <Neeraj.Upadhyay@amd.com>,
	RCU <rcu@vger.kernel.org>, LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>
Subject: Re: [PATCH 2/3] rcu: Enable rcu_normal_wake_from_gp on small systems
Date: Wed, 11 Jun 2025 11:25:24 +0200	[thread overview]
Message-ID: <aElLhFVlf-p5YWaq@pc636> (raw)
In-Reply-To: <d55a7d1b-d0c0-4c04-b69e-ca6737c98224@nvidia.com>

On Tue, Jun 10, 2025 at 02:34:10PM -0400, Joel Fernandes wrote:
> 
> 
> On 6/10/2025 1:34 PM, Uladzislau Rezki (Sony) wrote:
> > Automatically enable the rcu_normal_wake_from_gp parameter on
> > systems with a small number of CPUs. The activation threshold
> > is set to 16 CPUs.
> > 
> > This helps to reduce a latency of normal synchronize_rcu() API
> > by waking up GP-waiters earlier and decoupling synchronize_rcu()
> > callers from regular callback handling.
> > 
> > A benchmark running 64 parallel jobs invoking synchronize_rcu()
> > demonstrates a notable latency reduction with the setting enabled.
> > 
> > Latency distribution (microseconds):
> > 
> > <default>
> >  0      - 9999   : 1
> >  10000  - 19999  : 4
> >  20000  - 29999  : 399
> >  30000  - 39999  : 3197
> >  40000  - 49999  : 10428
> >  50000  - 59999  : 17363
> >  60000  - 69999  : 15529
> >  70000  - 79999  : 9287
> >  80000  - 89999  : 4249
> >  90000  - 99999  : 1915
> >  100000 - 109999 : 922
> >  110000 - 119999 : 390
> >  120000 - 129999 : 187
> >  ...
> > <default>
> > 
> > <rcu_normal_wake_from_gp>
> >  0      - 9999  : 1
> >  10000  - 19999 : 234
> >  20000  - 29999 : 6678
> >  30000  - 39999 : 33463
> >  40000  - 49999 : 20669
> >  50000  - 59999 : 2766
> >  60000  - 69999 : 183
> >  ...
> > <rcu_normal_wake_from_gp>
> > 
> > Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
> > ---
> >  kernel/rcu/tree.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
> > index 14d4499c6fc3..c0e0b38a08dc 100644
> > --- a/kernel/rcu/tree.c
> > +++ b/kernel/rcu/tree.c
> > @@ -1625,7 +1625,9 @@ static void rcu_sr_put_wait_head(struct llist_node *node)
> >  	atomic_set_release(&sr_wn->inuse, 0);
> >  }
> >  
> > -/* Disabled by default. */
> > +/* Enable rcu_normal_wake_from_gp automatically on small systems. */
> > +#define WAKE_FROM_GP_CPU_THRESHOLD 16
> > +
> >  static int rcu_normal_wake_from_gp;
> >  module_param(rcu_normal_wake_from_gp, int, 0644);
> >  static struct workqueue_struct *sync_wq;
> > @@ -4847,6 +4849,9 @@ void __init rcu_init(void)
> >  	sync_wq = alloc_workqueue("sync_wq", WQ_MEM_RECLAIM, 0);
> >  	WARN_ON(!sync_wq);
> >  
> > +	if (num_possible_cpus() <= WAKE_FROM_GP_CPU_THRESHOLD)
> > +		WRITE_ONCE(rcu_normal_wake_from_gp, 1);
> > +
> I think this will get weird if user explictly specifies
> rcutree.rcu_normal_wake_from_gp=0 ? Then we're silently overriding the param.
> Maybe, initialize it to -1, and then if it was set 0 by user, don't override it.
> But otherwise, set it to 1.  Per your third patch, '1' is a default, not a
> forced value.
> 
Right. That case should be fixed.

--
Uladzislau Rezki

  reply	other threads:[~2025-06-11  9:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-10 17:34 [PATCH 1/3] rcu: Return early if callback is not specified Uladzislau Rezki (Sony)
2025-06-10 17:34 ` [PATCH 2/3] rcu: Enable rcu_normal_wake_from_gp on small systems Uladzislau Rezki (Sony)
2025-06-10 18:34   ` Joel Fernandes
2025-06-11  9:25     ` Uladzislau Rezki [this message]
2025-06-10 17:34 ` [PATCH 3/3] Documentation/kernel-parameters: Update rcu_normal_wake_from_gp doc Uladzislau Rezki (Sony)
2025-06-10 19:33 ` [PATCH 1/3] rcu: Return early if callback is not specified Joel Fernandes
2025-06-11  9:24   ` Uladzislau Rezki
2025-06-12 17:30   ` Boqun Feng
2025-06-12 17:33     ` Boqun Feng
2025-06-12 17:46     ` Uladzislau Rezki
2025-06-12 21:03       ` Boqun Feng
2025-06-17  2:25         ` Joel Fernandes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aElLhFVlf-p5YWaq@pc636 \
    --to=urezki@gmail.com \
    --cc=Neeraj.Upadhyay@amd.com \
    --cc=frederic@kernel.org \
    --cc=joel@joelfernandes.org \
    --cc=joelagnelf@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksiy.avramchenko@sony.com \
    --cc=paulmck@kernel.org \
    --cc=rcu@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).