diff options
author | Oleg Nesterov <oleg@redhat.com> | 2014-01-24 00:55:35 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-01-24 01:37:01 +0100 |
commit | 74e37200de8e9c4e09b70c21c3f13c2071e77457 (patch) | |
tree | de7db4aa1113562665ba7f72d92ef33be788f7b7 /fs/proc/self.c | |
parent | coredump: make __get_dumpable/get_dumpable inline, kill fs/coredump.h (diff) | |
download | linux-74e37200de8e9c4e09b70c21c3f13c2071e77457.tar.xz linux-74e37200de8e9c4e09b70c21c3f13c2071e77457.zip |
proc: cleanup/simplify get_task_state/task_state_array
get_task_state() and task_state_array[] look confusing and suboptimal, it
is not clear what it can actually report to user-space and
task_state_array[] blows .data for no reason.
1. state = (tsk->state & TASK_REPORT) | tsk->exit_state is not
clear. TASK_REPORT is self-documenting but it is not clear
what ->exit_state can add.
Move the potential exit_state's (EXIT_ZOMBIE and EXIT_DEAD)
into TASK_REPORT and use it to calculate the final result.
2. With the change above it is obvious that task_state_array[]
has the unused entries just to make BUILD_BUG_ON() happy.
Change this BUILD_BUG_ON() to use TASK_REPORT rather than
TASK_STATE_MAX and shrink task_state_array[].
3. Turn the "while (state)" loop into fls(state).
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/proc/self.c')
0 files changed, 0 insertions, 0 deletions