• Oleg Nesterov's avatar
    exit: wait: don't use zombie->real_parent · f953ccd0
    Oleg Nesterov authored
    1. wait_task_zombie() uses p->real_parent to get psig/siglock. This is
       correct but needs tasklist_lock, ->real_parent can exit.
    
       We can use "current" instead. This is our natural child, its parent
       must be our sub-thread.
    
    2. Read psig/sig outside of ->siglock, ->signal is no longer protected
       by this lock.
    
    3. Fix the outdated comments about tasklist_lock. We can not race with
       __exit_signal(), the whole thread group is dead, nobody but us can
       call it.
    
       Also clarify the usage of ->stats_lock and ->siglock.
    
    Note: thread_group_cputime_adjusted() is sub-optimal in this case, we
    probably want to export cputime_adjust() to avoid thread_group_cputime().
    The comment says "all threads" but there are no other threads.
    Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
    Cc: Aaron Tomlin <atomlin@redhat.com>
    Cc: "Eric W. Biederman" <ebiederm@xmission.com>
    Cc: Rik van Riel <riel@redhat.com>
    Cc: Sterling Alexander <stalexan@redhat.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    f953ccd0
exit.c 41.8 KB