From: paulmck@kernel.org
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org,
Lai Jiangshan <laijs@linux.alibaba.com>,
"Paul E . McKenney" <paulmck@kernel.org>
Subject: [PATCH tip/core/rcu 06/12] rcu: Move gp_state_names[] and gp_state_getname() to tree_stall.h
Date: Mon, 9 Dec 2019 20:07:35 -0800 [thread overview]
Message-ID: <20191210040741.2943-6-paulmck@kernel.org> (raw)
In-Reply-To: <20191210040714.GA2715@paulmck-ThinkPad-P72>
From: Lai Jiangshan <laijs@linux.alibaba.com>
Only tree_stall.h needs to get name from GP state, so this commit
moves the gp_state_names[] array and the gp_state_getname()
from kernel/rcu/tree.h and kernel/rcu/tree.c, respectively, to
kernel/rcu/tree_stall.h. While moving gp_state_names[], this commit
uses the GCC syntax to ensure that the right string is associated with
the right CPP macro.
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
Signed-off-by: Lai Jiangshan <laijs@linux.alibaba.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
kernel/rcu/tree.c | 10 ----------
kernel/rcu/tree.h | 12 ------------
kernel/rcu/tree_stall.h | 22 ++++++++++++++++++++++
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c
index ba154a3..bbb60ed 100644
--- a/kernel/rcu/tree.c
+++ b/kernel/rcu/tree.c
@@ -529,16 +529,6 @@ static struct rcu_node *rcu_get_root(void)
}
/*
- * Convert a ->gp_state value to a character string.
- */
-static const char *gp_state_getname(short gs)
-{
- if (gs < 0 || gs >= ARRAY_SIZE(gp_state_names))
- return "???";
- return gp_state_names[gs];
-}
-
-/*
* Send along grace-period-related data for rcutorture diagnostics.
*/
void rcutorture_get_gp_data(enum rcutorture_type test_type, int *flags,
diff --git a/kernel/rcu/tree.h b/kernel/rcu/tree.h
index 54ff989..9d5986a 100644
--- a/kernel/rcu/tree.h
+++ b/kernel/rcu/tree.h
@@ -368,18 +368,6 @@ struct rcu_state {
#define RCU_GP_CLEANUP 7 /* Grace-period cleanup started. */
#define RCU_GP_CLEANED 8 /* Grace-period cleanup complete. */
-static const char * const gp_state_names[] = {
- "RCU_GP_IDLE",
- "RCU_GP_WAIT_GPS",
- "RCU_GP_DONE_GPS",
- "RCU_GP_ONOFF",
- "RCU_GP_INIT",
- "RCU_GP_WAIT_FQS",
- "RCU_GP_DOING_FQS",
- "RCU_GP_CLEANUP",
- "RCU_GP_CLEANED",
-};
-
/*
* In order to export the rcu_state name to the tracing tools, it
* needs to be added in the __tracepoint_string section.
diff --git a/kernel/rcu/tree_stall.h b/kernel/rcu/tree_stall.h
index c0b8c45..f18adaf 100644
--- a/kernel/rcu/tree_stall.h
+++ b/kernel/rcu/tree_stall.h
@@ -279,6 +279,28 @@ static void print_cpu_stall_fast_no_hz(char *cp, int cpu)
#endif /* #else #ifdef CONFIG_RCU_FAST_NO_HZ */
+static const char * const gp_state_names[] = {
+ [RCU_GP_IDLE] = "RCU_GP_IDLE",
+ [RCU_GP_WAIT_GPS] = "RCU_GP_WAIT_GPS",
+ [RCU_GP_DONE_GPS] = "RCU_GP_DONE_GPS",
+ [RCU_GP_ONOFF] = "RCU_GP_ONOFF",
+ [RCU_GP_INIT] = "RCU_GP_INIT",
+ [RCU_GP_WAIT_FQS] = "RCU_GP_WAIT_FQS",
+ [RCU_GP_DOING_FQS] = "RCU_GP_DOING_FQS",
+ [RCU_GP_CLEANUP] = "RCU_GP_CLEANUP",
+ [RCU_GP_CLEANED] = "RCU_GP_CLEANED",
+};
+
+/*
+ * Convert a ->gp_state value to a character string.
+ */
+static const char *gp_state_getname(short gs)
+{
+ if (gs < 0 || gs >= ARRAY_SIZE(gp_state_names))
+ return "???";
+ return gp_state_names[gs];
+}
+
/*
* Print out diagnostic information for the specified stalled CPU.
*
--
2.9.5
next prev parent reply other threads:[~2019-12-10 4:08 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 4:07 [PATCH tip/core/rcu 0/12] Miscellaneous fixes for v5.6 Paul E. McKenney
2019-12-10 4:07 ` [PATCH tip/core/rcu 01/12] rcu: Remove rcu_swap_protected() paulmck
2019-12-11 3:35 ` Martin K. Petersen
2019-12-11 3:51 ` Paul E. McKenney
2019-12-11 18:37 ` Paul E. McKenney
2019-12-11 19:09 ` Matthias Brugger
2019-12-11 23:12 ` Paul E. McKenney
2019-12-12 9:31 ` Kalle Valo
[not found] ` <87mubxdh52.fsf@kamboji.qca.qualcomm.com>
2019-12-12 18:21 ` Paul E. McKenney
2019-12-10 4:07 ` [PATCH tip/core/rcu 02/12] rcu: Mark non-global functions and variables as static paulmck
2019-12-10 4:07 ` [PATCH tip/core/rcu 03/12] rcu: Fix harmless omission of "CONFIG_" from #if condition paulmck
2019-12-10 4:07 ` [PATCH tip/core/rcu 04/12] rcu: Fix tracepoint tracking RCU CPU kthread utilization paulmck
2019-12-10 4:07 ` [PATCH tip/core/rcu 05/12] rcu: Remove the declaration of call_rcu() in tree.h paulmck
2019-12-10 4:07 ` paulmck [this message]
2019-12-10 4:07 ` [PATCH tip/core/rcu 07/12] rcu: Move rcu_{expedited,normal} definitions into rcupdate.h paulmck
2019-12-10 4:07 ` [PATCH tip/core/rcu 08/12] rcu: Switch force_qs_rnp() to for_each_leaf_node_cpu_mask() paulmck
2019-12-10 4:07 ` [PATCH tip/core/rcu 09/12] srcu: Apply *_ONCE() to ->srcu_last_gp_end paulmck
2019-12-10 4:07 ` [PATCH tip/core/rcu 10/12] .mailmap: Add entries for old paulmck@kernel.org addresses paulmck
2019-12-11 19:03 ` Florian Fainelli
2019-12-11 23:14 ` Paul E. McKenney
2019-12-10 4:07 ` [PATCH tip/core/rcu 11/12] powerpc: Remove comment about read_barrier_depends() paulmck
2019-12-10 4:07 ` [PATCH tip/core/rcu 12/12] rcu: Remove unused stop-machine #include paulmck
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=20191210040741.2943-6-paulmck@kernel.org \
--to=paulmck@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=kernel-team@fb.com \
--cc=laijs@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/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).