Skip to content

Commit

Permalink
sched/debug: Ignore TASK_IDLE for SysRq-W
Browse files Browse the repository at this point in the history
Markus reported that tasks in TASK_IDLE state are reported by SysRq-W,
which results in undesirable clutter.

Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
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>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Sep 29, 2017
1 parent 06eb618 commit 5d68cc9
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion kernel/sched/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -5166,6 +5166,28 @@ void sched_show_task(struct task_struct *p)
put_task_stack(p);
}

static inline bool
state_filter_match(unsigned long state_filter, struct task_struct *p)
{
/* no filter, everything matches */
if (!state_filter)
return true;

/* filter, but doesn't match */
if (!(p->state & state_filter))
return false;

/*
* When looking for TASK_UNINTERRUPTIBLE skip TASK_IDLE (allows
* TASK_KILLABLE).
*/
if (state_filter == TASK_UNINTERRUPTIBLE && p->state == TASK_IDLE)
return false;

return true;
}


void show_state_filter(unsigned long state_filter)
{
struct task_struct *g, *p;
Expand All @@ -5188,7 +5210,7 @@ void show_state_filter(unsigned long state_filter)
*/
touch_nmi_watchdog();
touch_all_softlockup_watchdogs();
if (!state_filter || (p->state & state_filter))
if (state_filter_match(state_filter, p))
sched_show_task(p);
}

Expand Down

0 comments on commit 5d68cc9

Please sign in to comment.