diff options
Diffstat (limited to 'kernel/sched/core.c')
-rw-r--r-- | kernel/sched/core.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 18a6966567da..d17c5da523a0 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -5166,6 +5166,28 @@ void sched_show_task(struct task_struct *p) | |||
5166 | put_task_stack(p); | 5166 | put_task_stack(p); |
5167 | } | 5167 | } |
5168 | 5168 | ||
5169 | static inline bool | ||
5170 | state_filter_match(unsigned long state_filter, struct task_struct *p) | ||
5171 | { | ||
5172 | /* no filter, everything matches */ | ||
5173 | if (!state_filter) | ||
5174 | return true; | ||
5175 | |||
5176 | /* filter, but doesn't match */ | ||
5177 | if (!(p->state & state_filter)) | ||
5178 | return false; | ||
5179 | |||
5180 | /* | ||
5181 | * When looking for TASK_UNINTERRUPTIBLE skip TASK_IDLE (allows | ||
5182 | * TASK_KILLABLE). | ||
5183 | */ | ||
5184 | if (state_filter == TASK_UNINTERRUPTIBLE && p->state == TASK_IDLE) | ||
5185 | return false; | ||
5186 | |||
5187 | return true; | ||
5188 | } | ||
5189 | |||
5190 | |||
5169 | void show_state_filter(unsigned long state_filter) | 5191 | void show_state_filter(unsigned long state_filter) |
5170 | { | 5192 | { |
5171 | struct task_struct *g, *p; | 5193 | struct task_struct *g, *p; |
@@ -5188,7 +5210,7 @@ void show_state_filter(unsigned long state_filter) | |||
5188 | */ | 5210 | */ |
5189 | touch_nmi_watchdog(); | 5211 | touch_nmi_watchdog(); |
5190 | touch_all_softlockup_watchdogs(); | 5212 | touch_all_softlockup_watchdogs(); |
5191 | if (!state_filter || (p->state & state_filter)) | 5213 | if (state_filter_match(state_filter, p)) |
5192 | sched_show_task(p); | 5214 | sched_show_task(p); |
5193 | } | 5215 | } |
5194 | 5216 | ||