CHROMIUM: sched: Don't show sched debug when dumping tasks w/ filter

On systems with a lot of cores and with a lot of running processes the
sysrq_sched_debug_show() call can end up spewing _A LOT_ of data into
the debug log.  Sometimes you might want all that data, but other times
you might not.

One case where you might not want all that data is if you were in
show_state_filter() called from check_hung_task().  Specifically:
- We're probably just about to panic and so logs won't be stored to the
  filesystem.  That means panic info might be going to some sort of
  persistent RAM (pstore) or a serial console.
- If panic info is going to persistent RAM then we probably have limited
  space, like maybe 128K.
- Calling sysrq_sched_debug_show() can very easily blow through 128K of
  space.
- If we blow through the 128K of space then the super important bits
  printed out by check_hung_task() (the name of the task that is hung
  plus the stack crawls) will be cut off, rendering the log nearly
  useless.

It seems sane to make show_state_filter() only dump this debug info when
the state_filter was 0.  When the state_filter is 0 then we're spewing a
whole lot of data anyway and so the sched debug info shouldn't hurt.  If
we're only dumping _some_ of the tasks then presumably we only want info
about those tasks and should avoid the extra crud.

NOTE: an alternative to this fix might be to turn off SCHED_DEBUG, but
that appears to have been purposefully turned on so we could implement a
feature in the Chrome Browser's Task Manager.  See
<http://crbug.com/120488>

BUG=chromium:658937
TEST=echo HUNG_TASK > /sys/kernel/debug/provoke-crash/DIRECT

Change-Id: I0d99adc02b9a4e93ef0515b9be304f06f20e8edf
Fixes: 023068f26f73 ("CHROMIUM: hung_task: dump all UNINTERUPTIBLE tasks")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/404588
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
(cherry picked from commit 73ce7a4bc343eff5df6b125362c5beb9d880bbcb)
Reviewed-on: https://chromium-review.googlesource.com/456919
1 file changed