Skip to content

Commit 1d48b08

Browse files
Peter ZijlstraIngo Molnar
authored andcommitted
sched/debug: Rename task-state printing helpers
Steve requested better names for the new task-state helper functions. So introduce the concept of task-state index for the printing and rename __get_task_state() to task_state_index() and __task_state_to_char() to task_index_to_char(). Requested-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/20170929115016.pzlqc7ss3ccystyg@hirez.programming.kicks-ass.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent 62cb118 commit 1d48b08

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

fs/proc/array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static const char * const task_state_array[] = {
137137
static inline const char *get_task_state(struct task_struct *tsk)
138138
{
139139
BUILD_BUG_ON(1 + ilog2(TASK_REPORT_MAX) != ARRAY_SIZE(task_state_array));
140-
return task_state_array[__get_task_state(tsk)];
140+
return task_state_array[task_state_index(tsk)];
141141
}
142142

143143
static inline int get_task_umask(struct task_struct *tsk)

include/linux/sched.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ static inline pid_t task_pgrp_nr(struct task_struct *tsk)
12481248
#define TASK_REPORT_IDLE (TASK_REPORT + 1)
12491249
#define TASK_REPORT_MAX (TASK_REPORT_IDLE << 1)
12501250

1251-
static inline unsigned int __get_task_state(struct task_struct *tsk)
1251+
static inline unsigned int task_state_index(struct task_struct *tsk)
12521252
{
12531253
unsigned int tsk_state = READ_ONCE(tsk->state);
12541254
unsigned int state = (tsk_state | tsk->exit_state) & TASK_REPORT;
@@ -1261,7 +1261,7 @@ static inline unsigned int __get_task_state(struct task_struct *tsk)
12611261
return fls(state);
12621262
}
12631263

1264-
static inline char __task_state_to_char(unsigned int state)
1264+
static inline char task_index_to_char(unsigned int state)
12651265
{
12661266
static const char state_char[] = "RSDTtXZPI";
12671267

@@ -1272,7 +1272,7 @@ static inline char __task_state_to_char(unsigned int state)
12721272

12731273
static inline char task_state_to_char(struct task_struct *tsk)
12741274
{
1275-
return __task_state_to_char(__get_task_state(tsk));
1275+
return task_index_to_char(task_state_index(tsk));
12761276
}
12771277

12781278
/**

include/trace/events/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static inline long __trace_sched_switch_state(bool preempt, struct task_struct *
117117
if (preempt)
118118
return TASK_STATE_MAX;
119119

120-
return __get_task_state(p);
120+
return task_state_index(p);
121121
}
122122
#endif /* CREATE_TRACE_POINTS */
123123

kernel/trace/trace_output.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -921,8 +921,8 @@ static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter,
921921

922922
trace_assign_type(field, iter->ent);
923923

924-
T = __task_state_to_char(field->next_state);
925-
S = __task_state_to_char(field->prev_state);
924+
T = task_index_to_char(field->next_state);
925+
S = task_index_to_char(field->prev_state);
926926
trace_find_cmdline(field->next_pid, comm);
927927
trace_seq_printf(&iter->seq,
928928
" %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n",
@@ -957,8 +957,8 @@ static int trace_ctxwake_raw(struct trace_iterator *iter, char S)
957957
trace_assign_type(field, iter->ent);
958958

959959
if (!S)
960-
S = __task_state_to_char(field->prev_state);
961-
T = __task_state_to_char(field->next_state);
960+
S = task_index_to_char(field->prev_state);
961+
T = task_index_to_char(field->next_state);
962962
trace_seq_printf(&iter->seq, "%d %d %c %d %d %d %c\n",
963963
field->prev_pid,
964964
field->prev_prio,
@@ -993,8 +993,8 @@ static int trace_ctxwake_hex(struct trace_iterator *iter, char S)
993993
trace_assign_type(field, iter->ent);
994994

995995
if (!S)
996-
S = __task_state_to_char(field->prev_state);
997-
T = __task_state_to_char(field->next_state);
996+
S = task_index_to_char(field->prev_state);
997+
T = task_index_to_char(field->next_state);
998998

999999
SEQ_PUT_HEX_FIELD(s, field->prev_pid);
10001000
SEQ_PUT_HEX_FIELD(s, field->prev_prio);

kernel/trace/trace_sched_wakeup.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,10 @@ tracing_sched_switch_trace(struct trace_array *tr,
397397
entry = ring_buffer_event_data(event);
398398
entry->prev_pid = prev->pid;
399399
entry->prev_prio = prev->prio;
400-
entry->prev_state = __get_task_state(prev);
400+
entry->prev_state = task_state_index(prev);
401401
entry->next_pid = next->pid;
402402
entry->next_prio = next->prio;
403-
entry->next_state = __get_task_state(next);
403+
entry->next_state = task_state_index(next);
404404
entry->next_cpu = task_cpu(next);
405405

406406
if (!call_filter_check_discard(call, entry, buffer, event))
@@ -425,10 +425,10 @@ tracing_sched_wakeup_trace(struct trace_array *tr,
425425
entry = ring_buffer_event_data(event);
426426
entry->prev_pid = curr->pid;
427427
entry->prev_prio = curr->prio;
428-
entry->prev_state = __get_task_state(curr);
428+
entry->prev_state = task_state_index(curr);
429429
entry->next_pid = wakee->pid;
430430
entry->next_prio = wakee->prio;
431-
entry->next_state = __get_task_state(wakee);
431+
entry->next_state = task_state_index(wakee);
432432
entry->next_cpu = task_cpu(wakee);
433433

434434
if (!call_filter_check_discard(call, entry, buffer, event))

0 commit comments

Comments
 (0)