Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1738977 > unrolled thread

[PATCH 7/8] sched: Ignore TASK_IDLE for SysRq-W

Started byPeter Zijlstra <peterz@infradead.org>
First post2017-09-25 14:20 +0200
Last post2017-09-25 14:20 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 7/8] sched: Ignore TASK_IDLE for SysRq-W Peter Zijlstra <peterz@infradead.org> - 2017-09-25 14:20 +0200

#1738977 — [PATCH 7/8] sched: Ignore TASK_IDLE for SysRq-W

FromPeter Zijlstra <peterz@infradead.org>
Date2017-09-25 14:20 +0200
Subject[PATCH 7/8] sched: Ignore TASK_IDLE for SysRq-W
Message-ID<utAwG-6f6-25@gated-at.bofh.it>
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>
---
 kernel/sched/core.c |   24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5164,6 +5164,28 @@ void sched_show_task(struct task_struct
 	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;
@@ -5186,7 +5208,7 @@ void show_state_filter(unsigned long sta
 		 */
 		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);
 	}
 

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web