Re: about 'kernel.sched_schedule'

Mathieu Desnoyers <[email protected]> Tue, 4 Sep 2007 07:41:50 -0400
Newsgroups gmane.linux.kernel.tracing
Message-ID <20070904114150.GF14618@Krystal>
* yuanbor ([email protected]) wrote:
> hi,all
>   
>  in the line of 'kernel.sched_schedule' trace, there are three important items:
>  1.prev_pid;2.next_pid;3.prev_state
>   
>  in one of my trace file , I find prev_state has 4 values:-1,0,1,2
>  I just get the following info: -1 unrunnable, 0 runnable, >0 stopped
>   
>  what I want to know is the exactly meaning of the 4 values,
>  is there anybody can tell me ?
>   

in the linux kernel:
kernel/sched.c:

trace_mark(kernel_sched_wait_task, "%d %ld", p->pid, p->state);

include/linux/sched.h
So struct task_struct, the state field:


/*
 * Task state bitmask. NOTE! These bits are also
 * encoded in fs/proc/array.c: get_task_state().
 *
 * We have two separate sets of flags: task->state
 * is about runnability, while task->exit_state are
 * about the task exiting. Confusing, but this way
 * modifying one set can't modify the other one by
 * mistake.
 */
#define TASK_RUNNING            0
#define TASK_INTERRUPTIBLE      1
#define TASK_UNINTERRUPTIBLE    2
#define TASK_STOPPED            4
#define TASK_TRACED             8
/* in tsk->exit_state */
#define EXIT_ZOMBIE             16
#define EXIT_DEAD               32
/* in tsk->state again */
#define TASK_NONINTERACTIVE     64
#define TASK_DEAD               128

So this is the exact meaning.

Mathieu

>  thank u very much!

> _______________________________________________
> Ltt-dev mailing list
> [email protected]
> http://listserv.shafik.org/mailman/listinfo/ltt-dev


-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68