From: "Neeraj Upadhyay (AMD)" <neeraj.iitr10@gmail.com>
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
rostedt@goodmis.org, paulmck@kernel.org, Neeraj.Upadhyay@amd.com,
Frederic Weisbecker <frederic@kernel.org>,
Joel Fernandes <joel@joelfernandes.org>,
Neeraj Upadhyay <neeraj.iitr10@gmail.com>
Subject: [PATCH rcu 2/3] srcu: No need to advance/accelerate if no callback enqueued
Date: Tue, 12 Dec 2023 23:18:16 +0530 [thread overview]
Message-ID: <20231212174817.11919-2-neeraj.iitr10@gmail.com> (raw)
In-Reply-To: <20231212174750.GA11886@neeraj.linux>
From: Frederic Weisbecker <frederic@kernel.org>
While in grace period start, there is nothing to accelerate and
therefore no need to advance the callbacks either if no callback is
to be enqueued.
Spare these needless operations in this case.
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Neeraj Upadhyay (AMD) <neeraj.iitr10@gmail.com>
---
kernel/rcu/srcutree.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index e9356a103626..2bfc8ed1eed2 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -1261,9 +1261,11 @@ static unsigned long srcu_gp_start_if_needed(struct srcu_struct *ssp,
* period (gp_num = X + 8). So acceleration fails.
*/
s = rcu_seq_snap(&ssp->srcu_sup->srcu_gp_seq);
- rcu_segcblist_advance(&sdp->srcu_cblist,
- rcu_seq_current(&ssp->srcu_sup->srcu_gp_seq));
- WARN_ON_ONCE(!rcu_segcblist_accelerate(&sdp->srcu_cblist, s) && rhp);
+ if (rhp) {
+ rcu_segcblist_advance(&sdp->srcu_cblist,
+ rcu_seq_current(&ssp->srcu_sup->srcu_gp_seq));
+ WARN_ON_ONCE(!rcu_segcblist_accelerate(&sdp->srcu_cblist, s));
+ }
if (ULONG_CMP_LT(sdp->srcu_gp_seq_needed, s)) {
sdp->srcu_gp_seq_needed = s;
needgp = true;
--
2.40.1
next prev parent reply other threads:[~2023-12-12 17:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 17:47 [PATCH rcu 0/3] SRCU updates for v6.8 Neeraj Upadhyay (AMD)
2023-12-12 17:48 ` [PATCH rcu 1/3] srcu: Remove superfluous callbacks advancing from srcu_gp_start() Neeraj Upadhyay (AMD)
2023-12-12 17:48 ` Neeraj Upadhyay (AMD) [this message]
2023-12-12 17:48 ` [PATCH rcu 3/3] srcu: Explain why callbacks invocations can't run concurrently Neeraj Upadhyay (AMD)
2023-12-13 14:27 ` Joel Fernandes
2023-12-13 17:52 ` Paul E. McKenney
2023-12-13 18:35 ` Joel Fernandes
2023-12-13 18:55 ` Paul E. McKenney
2023-12-13 19:01 ` Joel Fernandes
2023-12-13 18:18 ` [PATCH rcu 4/3] srcu: Use try-lock lockdep annotation for NMI-safe access Neeraj Upadhyay (AMD)
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=20231212174817.11919-2-neeraj.iitr10@gmail.com \
--to=neeraj.iitr10@gmail.com \
--cc=Neeraj.Upadhyay@amd.com \
--cc=frederic@kernel.org \
--cc=joel@joelfernandes.org \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.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
all inboxes | Powered by JetHome®