summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2017-09-22 18:37:28 +0200
committerIngo Molnar <mingo@kernel.org>2017-09-29 11:02:57 +0200
commit8ef9925b02c23e3838d5e593c5cf37984141150f (patch)
tree56dd45d5d85ba9aa3dd1cfa9bb9235db97d4b605
parent5d68cc95fb24b2f58060cc5340dd7402a11f054e (diff)
downloadlinux-8ef9925b02c23e3838d5e593c5cf37984141150f.tar.bz2
sched/debug: Add explicit TASK_PARKED printing
Currently TASK_PARKED is masqueraded as TASK_INTERRUPTIBLE, give it its own print state because it will not in fact get woken by regular wakeups and is a long-term state. This requires moving TASK_PARKED into the TASK_REPORT mask, and since that latter needs to be a contiguous bitmask, we need to shuffle the bits around a bit. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-kernel@vger.kernel.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--fs/proc/array.c3
-rw-r--r--include/linux/sched.h16
-rw-r--r--include/trace/events/sched.h2
3 files changed, 10 insertions, 11 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index a120a4549d48..77a8eacbe032 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -128,9 +128,10 @@ static const char * const task_state_array[] = {
"t (tracing stop)", /* 0x08 */
"X (dead)", /* 0x10 */
"Z (zombie)", /* 0x20 */
+ "P (parked)", /* 0x40 */
/* states beyond TASK_REPORT: */
- "I (idle)", /* 0x40 */
+ "I (idle)", /* 0x80 */
};
static inline const char *get_task_state(struct task_struct *tsk)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 286fc1117046..26a7df4e558c 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -75,10 +75,10 @@ struct task_group;
#define EXIT_ZOMBIE 0x0020
#define EXIT_TRACE (EXIT_ZOMBIE | EXIT_DEAD)
/* Used in tsk->state again: */
-#define TASK_DEAD 0x0040
-#define TASK_WAKEKILL 0x0080
-#define TASK_WAKING 0x0100
-#define TASK_PARKED 0x0200
+#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
@@ -97,7 +97,8 @@ struct task_group;
/* get_task_state(): */
#define TASK_REPORT (TASK_RUNNING | TASK_INTERRUPTIBLE | \
TASK_UNINTERRUPTIBLE | __TASK_STOPPED | \
- __TASK_TRACED | EXIT_DEAD | EXIT_ZOMBIE)
+ __TASK_TRACED | EXIT_DEAD | EXIT_ZOMBIE | \
+ TASK_PARKED)
#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0)
@@ -1251,9 +1252,6 @@ static inline unsigned int __get_task_state(struct task_struct *tsk)
BUILD_BUG_ON_NOT_POWER_OF_2(TASK_REPORT_MAX);
- if (tsk_state == TASK_PARKED)
- state = TASK_INTERRUPTIBLE;
-
if (tsk_state == TASK_IDLE)
state = TASK_REPORT_IDLE;
@@ -1262,7 +1260,7 @@ static inline unsigned int __get_task_state(struct task_struct *tsk)
static inline char __task_state_to_char(unsigned int state)
{
- static const char state_char[] = "RSDTtXZI";
+ static const char state_char[] = "RSDTtXZPI";
BUILD_BUG_ON(1 + ilog2(TASK_REPORT_MAX) != sizeof(state_char) - 1);
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index b371ef8206e1..3c8b7f625670 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -160,7 +160,7 @@ TRACE_EVENT(sched_switch,
__print_flags(__entry->prev_state & (TASK_REPORT_MAX - 1), "|",
{ 0x01, "S" }, { 0x02, "D" }, { 0x04, "T" },
{ 0x08, "t" }, { 0x10, "X" }, { 0x20, "Z" },
- { 0x40, "I" }) :
+ { 0x40, "P" }, { 0x80, "I" }) :
"R",
__entry->prev_state & TASK_STATE_MAX ? "+" : "",