summaryrefslogtreecommitdiff
path: root/kernel/sched/debug.c
diff options
context:
space:
mode:
authorXie XiuQi <xiexiuqi@huawei.com>2017-08-07 16:44:23 +0800
committerIngo Molnar <mingo@kernel.org>2017-08-10 12:18:20 +0200
commit20435d84e5f2041c64c792399ab6f2948a2c2252 (patch)
tree7576b55eef9f3291f3488635e1ab60cdf23ea19e /kernel/sched/debug.c
parente8c164954b926f06f109a42fb8595ed01275b141 (diff)
sched/debug: Intruduce task_state_to_char() helper function
Now that we have more than one place to get the task state, intruduce the task_state_to_char() helper function to save some code. No functionality changed. Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: <cj.chengjian@huawei.com> Cc: <huawei.libin@huawei.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/1502095463-160172-3-git-send-email-xiexiuqi@huawei.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/sched/debug.c')
-rw-r--r--kernel/sched/debug.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index d8d2ea215b85..cfd84f79e075 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -426,14 +426,10 @@ static const char stat_nam[] = TASK_STATE_TO_CHAR_STR;
static void
print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
{
- unsigned long state;
-
- if (rq->curr == p) {
+ if (rq->curr == p)
SEQ_printf(m, ">R");
- } else {
- state = p->state ? __ffs(p->state) + 1 : 0;
- SEQ_printf(m, " %c", state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?');
- }
+ else
+ SEQ_printf(m, " %c", task_state_to_char(p));
SEQ_printf(m, "%15s %5d %9Ld.%06ld %9Ld %5d ",
p->comm, task_pid_nr(p),