Skip to content

Commit e2167b3

Browse files
laijspaulmckrcu
authored andcommitted
rcu: Move gp_state_names[] and gp_state_getname() to tree_stall.h
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 <[email protected]> Signed-off-by: Lai Jiangshan <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 4778339 commit e2167b3

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

kernel/rcu/tree.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -528,16 +528,6 @@ static struct rcu_node *rcu_get_root(void)
528528
return &rcu_state.node[0];
529529
}
530530

531-
/*
532-
* Convert a ->gp_state value to a character string.
533-
*/
534-
static const char *gp_state_getname(short gs)
535-
{
536-
if (gs < 0 || gs >= ARRAY_SIZE(gp_state_names))
537-
return "???";
538-
return gp_state_names[gs];
539-
}
540-
541531
/*
542532
* Send along grace-period-related data for rcutorture diagnostics.
543533
*/

kernel/rcu/tree.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -368,18 +368,6 @@ struct rcu_state {
368368
#define RCU_GP_CLEANUP 7 /* Grace-period cleanup started. */
369369
#define RCU_GP_CLEANED 8 /* Grace-period cleanup complete. */
370370

371-
static const char * const gp_state_names[] = {
372-
"RCU_GP_IDLE",
373-
"RCU_GP_WAIT_GPS",
374-
"RCU_GP_DONE_GPS",
375-
"RCU_GP_ONOFF",
376-
"RCU_GP_INIT",
377-
"RCU_GP_WAIT_FQS",
378-
"RCU_GP_DOING_FQS",
379-
"RCU_GP_CLEANUP",
380-
"RCU_GP_CLEANED",
381-
};
382-
383371
/*
384372
* In order to export the rcu_state name to the tracing tools, it
385373
* needs to be added in the __tracepoint_string section.

kernel/rcu/tree_stall.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,28 @@ static void print_cpu_stall_fast_no_hz(char *cp, int cpu)
279279

280280
#endif /* #else #ifdef CONFIG_RCU_FAST_NO_HZ */
281281

282+
static const char * const gp_state_names[] = {
283+
[RCU_GP_IDLE] = "RCU_GP_IDLE",
284+
[RCU_GP_WAIT_GPS] = "RCU_GP_WAIT_GPS",
285+
[RCU_GP_DONE_GPS] = "RCU_GP_DONE_GPS",
286+
[RCU_GP_ONOFF] = "RCU_GP_ONOFF",
287+
[RCU_GP_INIT] = "RCU_GP_INIT",
288+
[RCU_GP_WAIT_FQS] = "RCU_GP_WAIT_FQS",
289+
[RCU_GP_DOING_FQS] = "RCU_GP_DOING_FQS",
290+
[RCU_GP_CLEANUP] = "RCU_GP_CLEANUP",
291+
[RCU_GP_CLEANED] = "RCU_GP_CLEANED",
292+
};
293+
294+
/*
295+
* Convert a ->gp_state value to a character string.
296+
*/
297+
static const char *gp_state_getname(short gs)
298+
{
299+
if (gs < 0 || gs >= ARRAY_SIZE(gp_state_names))
300+
return "???";
301+
return gp_state_names[gs];
302+
}
303+
282304
/*
283305
* Print out diagnostic information for the specified stalled CPU.
284306
*

0 commit comments

Comments
 (0)