[lttng-dev] What is _prev_state in sched_switch?

Christophe Bédard bedard.christophe at gmail.com
Mon Jul 29 05:53:08 EDT 2019


Hi,

Re-sending since I previously used an email address not subscribed to the
ML.

On Mon, 29 Jul 2019 at 11:08, Ravindra Kumar Meena <rmeena840 at gmail.com>
wrote:

> Okay. The above link was somewhat helpful but I still didn't get what is
> the meaning of {0, 1, 1026, 4096} values in _prev_state.
>
> In babeltrace output _prev_state have { 0, 1, 1026, 4096 } values.
>
>
I think the answer to your question was in Sebastien's email.

$ grep "#define TASK_" include/linux/sched.h
> #define TASK_RUNNING                    0x0000
> #define TASK_INTERRUPTIBLE              0x0001
> #define TASK_UNINTERRUPTIBLE            0x0002
> #define TASK_PARKED                     0x0040
> #define TASK_DEAD                       0x0080
> #define TASK_WAKEKILL                   0x0100
> #define TASK_WAKING                     0x0200
> #define TASK_NOLOAD                     0x0400
> #define TASK_NEW                        0x0800
> #define TASK_STATE_MAX                  0x1000
> #define TASK_KILLABLE                   (TASK_WAKEKILL |
> TASK_UNINTERRUPTIBLE)
> #define TASK_STOPPED                    (TASK_WAKEKILL | __TASK_STOPPED)
> #define TASK_TRACED                     (TASK_WAKEKILL | __TASK_TRACED)
> #define TASK_IDLE                       (TASK_UNINTERRUPTIBLE |
> TASK_NOLOAD)
> #define TASK_NORMAL                     (TASK_INTERRUPTIBLE |
> TASK_UNINTERRUPTIBLE)
> #define TASK_REPORT                     (TASK_RUNNING | TASK_INTERRUPTIBLE
> | \
>

States can be combined (OR'd).

1026 in decimal is 0x402 which is 0x400 | 0x002. That is TASK_NOLOAD |
TASK_UNINTERRUPTIBLE, or, as defined above, it's simply TASK_IDLE.

I'm not sure what other answer you're expecting.


Christophe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20190729/00d42680/attachment.html>


More information about the lttng-dev mailing list