mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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 <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Cc: <[email protected]> Cc: <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
e8c164954b
commit
20435d84e5
3 changed files with 20 additions and 18 deletions
|
|
@ -5103,24 +5103,17 @@ out_unlock:
|
|||
return retval;
|
||||
}
|
||||
|
||||
static const char stat_nam[] = TASK_STATE_TO_CHAR_STR;
|
||||
|
||||
void sched_show_task(struct task_struct *p)
|
||||
{
|
||||
unsigned long free = 0;
|
||||
int ppid;
|
||||
unsigned long state = p->state;
|
||||
|
||||
/* Make sure the string lines up properly with the number of task states: */
|
||||
BUILD_BUG_ON(sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1);
|
||||
|
||||
if (!try_get_task_stack(p))
|
||||
return;
|
||||
if (state)
|
||||
state = __ffs(state) + 1;
|
||||
printk(KERN_INFO "%-15.15s %c", p->comm,
|
||||
state < sizeof(stat_nam) - 1 ? stat_nam[state] : '?');
|
||||
if (state == TASK_RUNNING)
|
||||
|
||||
printk(KERN_INFO "%-15.15s %c", p->comm, task_state_to_char(p));
|
||||
|
||||
if (p->state == TASK_RUNNING)
|
||||
printk(KERN_CONT " running task ");
|
||||
#ifdef CONFIG_DEBUG_STACK_USAGE
|
||||
free = stack_not_used(p);
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Reference in a new issue