aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/char/sysrq.c14
-rw-r--r--include/linux/sched.h11
-rw-r--r--kernel/sched.c11
3 files changed, 31 insertions, 5 deletions
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c
index c64f5bcff947..05810c8d20bc 100644
--- a/drivers/char/sysrq.c
+++ b/drivers/char/sysrq.c
@@ -182,6 +182,18 @@ static struct sysrq_key_op sysrq_showstate_op = {
182 .enable_mask = SYSRQ_ENABLE_DUMP, 182 .enable_mask = SYSRQ_ENABLE_DUMP,
183}; 183};
184 184
185static void sysrq_handle_showstate_blocked(int key, struct tty_struct *tty)
186{
187 show_state_filter(TASK_UNINTERRUPTIBLE);
188}
189static struct sysrq_key_op sysrq_showstate_blocked_op = {
190 .handler = sysrq_handle_showstate_blocked,
191 .help_msg = "showBlockedTasks",
192 .action_msg = "Show Blocked State",
193 .enable_mask = SYSRQ_ENABLE_DUMP,
194};
195
196
185static void sysrq_handle_showmem(int key, struct tty_struct *tty) 197static void sysrq_handle_showmem(int key, struct tty_struct *tty)
186{ 198{
187 show_mem(); 199 show_mem();
@@ -304,7 +316,7 @@ static struct sysrq_key_op *sysrq_key_table[36] = {
304 /* May be assigned at init time by SMP VOYAGER */ 316 /* May be assigned at init time by SMP VOYAGER */
305 NULL, /* v */ 317 NULL, /* v */
306 NULL, /* w */ 318 NULL, /* w */
307 NULL, /* x */ 319 &sysrq_showstate_blocked_op, /* x */
308 NULL, /* y */ 320 NULL, /* y */
309 NULL /* z */ 321 NULL /* z */
310}; 322};
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 837a012f573c..0a90cefb0b0d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -194,7 +194,16 @@ extern void init_idle(struct task_struct *idle, int cpu);
194 194
195extern cpumask_t nohz_cpu_mask; 195extern cpumask_t nohz_cpu_mask;
196 196
197extern void show_state(void); 197/*
198 * Only dump TASK_* tasks. (-1 for all tasks)
199 */
200extern void show_state_filter(unsigned long state_filter);
201
202static inline void show_state(void)
203{
204 show_state_filter(-1);
205}
206
198extern void show_regs(struct pt_regs *); 207extern void show_regs(struct pt_regs *);
199 208
200/* 209/*
diff --git a/kernel/sched.c b/kernel/sched.c
index 12fdbef1d9bf..1848e280504d 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4804,7 +4804,7 @@ static void show_task(struct task_struct *p)
4804 show_stack(p, NULL); 4804 show_stack(p, NULL);
4805} 4805}
4806 4806
4807void show_state(void) 4807void show_state_filter(unsigned long state_filter)
4808{ 4808{
4809 struct task_struct *g, *p; 4809 struct task_struct *g, *p;
4810 4810
@@ -4824,11 +4824,16 @@ void show_state(void)
4824 * console might take alot of time: 4824 * console might take alot of time:
4825 */ 4825 */
4826 touch_nmi_watchdog(); 4826 touch_nmi_watchdog();
4827 show_task(p); 4827 if (p->state & state_filter)
4828 show_task(p);
4828 } while_each_thread(g, p); 4829 } while_each_thread(g, p);
4829 4830
4830 read_unlock(&tasklist_lock); 4831 read_unlock(&tasklist_lock);
4831 debug_show_all_locks(); 4832 /*
4833 * Only show locks if all tasks are dumped:
4834 */
4835 if (state_filter == -1)
4836 debug_show_all_locks();
4832} 4837}
4833 4838
4834/** 4839/**