From: Pingfan Liu <kernelfans@gmail.com>
To: rcu@vger.kernel.org
Cc: Pingfan Liu <kernelfans@gmail.com>,
Lai Jiangshan <jiangshanlai@gmail.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
Frederic Weisbecker <frederic@kernel.org>,
Josh Triplett <josh@joshtriplett.org>,
Steven Rostedt <rostedt@goodmis.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
"Zhang, Qiang1" <qiang1.zhang@intel.com>
Subject: [PATCH 3/3] srcu: Decrease the srcu size state numbers
Date: Mon, 28 Nov 2022 16:28:16 +0800 [thread overview]
Message-ID: <20221128082816.28518-4-kernelfans@gmail.com> (raw)
In-Reply-To: <20221128082816.28518-1-kernelfans@gmail.com>
With the previous patch, srcu_cb_mutex is held when setting
SRCU_SIZE_WAIT_BARRIER. It means that only two seq snap value can exist.
And these two snaps can not see the active snp tree if
srcu_gp_start_if_needed() fetches the srcu_size_state before it is
updated to SRCU_SIZE_WAIT_BARRIER.
After dispatching these two snap value's callbacks, the mask in
snp->srcu_data_have_cbs[idx] is assured to be right. Hence the size
state following SRCU_SIZE_WAIT_BARRIER can be shrink to three.
Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
Cc: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: "Paul E. McKenney" <paulmck@kernel.org>
Cc: Frederic Weisbecker <frederic@kernel.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: "Zhang, Qiang1" <qiang1.zhang@intel.com>
To: rcu@vger.kernel.org
---
include/linux/srcutree.h | 15 +++++++++------
kernel/rcu/srcutree.c | 3 ---
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/linux/srcutree.h b/include/linux/srcutree.h
index e3014319d1ad..34cb9435c14d 100644
--- a/include/linux/srcutree.h
+++ b/include/linux/srcutree.h
@@ -94,13 +94,16 @@ struct srcu_struct {
/* Values for size state variable (->srcu_size_state). */
#define SRCU_SIZE_SMALL 0
#define SRCU_SIZE_ALLOC 1
+/* If snp tree is initialized */
#define SRCU_SIZE_WAIT_BARRIER 2
-#define SRCU_SIZE_WAIT_CALL 3
-#define SRCU_SIZE_WAIT_CBS1 4
-#define SRCU_SIZE_WAIT_CBS2 5
-#define SRCU_SIZE_WAIT_CBS3 6
-#define SRCU_SIZE_WAIT_CBS4 7
-#define SRCU_SIZE_BIG 8
+/*
+ * The following two states for the in-flight seq snap, who may not see
+ * the snp tree is active.
+ */
+#define SRCU_SIZE_WAIT_CBS1 3
+#define SRCU_SIZE_WAIT_CBS2 4
+/* All seq snap see the active tree */
+#define SRCU_SIZE_BIG 5
/* Values for state variable (bottom bits of ->srcu_gp_seq). */
#define SRCU_STATE_IDLE 0
diff --git a/kernel/rcu/srcutree.c b/kernel/rcu/srcutree.c
index 281cd69fe804..bdf392e2ef63 100644
--- a/kernel/rcu/srcutree.c
+++ b/kernel/rcu/srcutree.c
@@ -1652,11 +1652,8 @@ static const char * const srcu_size_state_name[] = {
"SRCU_SIZE_SMALL",
"SRCU_SIZE_ALLOC",
"SRCU_SIZE_WAIT_BARRIER",
- "SRCU_SIZE_WAIT_CALL",
"SRCU_SIZE_WAIT_CBS1",
"SRCU_SIZE_WAIT_CBS2",
- "SRCU_SIZE_WAIT_CBS3",
- "SRCU_SIZE_WAIT_CBS4",
"SRCU_SIZE_BIG",
"SRCU_SIZE_???",
};
--
2.31.1
prev parent reply other threads:[~2022-11-28 8:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-28 8:28 [PATCH 0/3] srcu: shrink the num of srcu_size_state Pingfan Liu
2022-11-28 8:28 ` [PATCH 1/3] srcu: Eliminate the requirement of SRCU_SIZE_WAIT_CALL Pingfan Liu
2022-11-28 8:40 ` Zhang, Qiang1
2022-11-28 14:01 ` Pingfan Liu
2022-11-29 0:41 ` Paul E. McKenney
2022-11-30 3:34 ` [PATCHv2] " Pingfan Liu
2022-12-02 22:17 ` Paul E. McKenney
2022-12-13 12:51 ` Pingfan Liu
2022-12-13 20:02 ` Paul E. McKenney
2022-12-15 3:37 ` Pingfan Liu
2022-12-16 16:54 ` Paul E. McKenney
2022-11-28 8:28 ` [PATCH 2/3] srcu: protect against concurrent srcu_gp_end() Pingfan Liu
2022-11-28 9:20 ` Zhang, Qiang1
2022-11-28 14:36 ` Pingfan Liu
2022-11-28 14:47 ` Zhang, Qiang1
2022-11-30 3:36 ` Pingfan Liu
2022-11-28 8:28 ` Pingfan Liu [this message]
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=20221128082816.28518-4-kernelfans@gmail.com \
--to=kernelfans@gmail.com \
--cc=frederic@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=josh@joshtriplett.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=paulmck@kernel.org \
--cc=qiang1.zhang@intel.com \
--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