]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
rcu: Move gp_state_names[] and gp_state_getname() to tree_stall.h
authorLai Jiangshan <jiangshanlai@gmail.com>
Tue, 15 Oct 2019 10:28:47 +0000 (10:28 +0000)
committerPaul E. McKenney <paulmck@kernel.org>
Fri, 24 Jan 2020 18:33:45 +0000 (10:33 -0800)
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
kernel/rcu/tree.h
kernel/rcu/tree_stall.h

index ba154a3080fb5280c272fab6e578451c59e0e4e7..bbb60ed310b178fd12193f2ceb5990fb5db269ea 100644 (file)
@@ -528,16 +528,6 @@ static struct rcu_node *rcu_get_root(void)
        return &rcu_state.node[0];
 }
 
-/*
- * 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.
  */
index 54ff9896ae31d2e550136ccaf8df212cf5150410..9d5986abfc67adf7de9aa2503d49b7d64acaf924 100644 (file)
@@ -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.
index c0b8c458d8a6ad267151f6cbffc791c217aeefdf..f18adaf3bf39d239282948621fe00c0d59f52dda 100644 (file)
@@ -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.
  *