• Roland McGrath's avatar
    [PATCH] task_struct.exit_state usage · 6ba7b420
    Roland McGrath authored
    I just did a quick audit of the use of exit_state and the EXIT_* bit
    macros.  I guess I didn't really review these changes very closely when you
    did them originally.  :-(
    
    I found several places that seem like lossy cases of query-replace without
    enough thought about the code.  Linus has previously said the >= tests
    ought to be & tests instead.  But for exit_state, it can only ever be 0,
    EXIT_DEAD, or EXIT_ZOMBIE--so a nonzero test is actually the same as
    testing & (EXIT_DEAD|EXIT_ZOMBIE), and maybe its code is a tiny bit better.
     The case like in choose_new_parent is just confusing, to have the
    always-false test for EXIT_* bits in ->state there too.
    
    The two cases in wants_signal and do_process_times are actual regressions
    that will give us back old bugs in race conditions.  These places had
    s/TASK/EXIT/ but not s/state/exit_state/, and now there tests for exiting
    tasks are now wrong and never catching them.  I take it back: there is no
    regression in wants_signal in practice I think, because of the PF_EXITING
    test that makes the EXIT_* state checks superfluous anyway.  So that is
    just another cosmetic case of confusing code.  But in do_process_times,
    there is that SIGXCPU-while-exiting race condition back again.
    Signed-off-by: default avatarRoland McGrath <roland@redhat.com>
    Acked-by: default avatarIngo Molnar <mingo@elte.hu>
    Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
    6ba7b420
signal.c 68.1 KB