]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: set task exit code before complete_vfork_done()
authorKonstantin Khlebnikov <khlebnikov@openvz.org>
Wed, 25 Apr 2012 01:03:05 +0000 (11:03 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 30 Apr 2012 05:17:07 +0000 (15:17 +1000)
kthread_stop() uses task->vfork_done for synchronization.  The exiting
kthread shouldn't do complete_vfork_done() until it sets ->exit_code.

fix for mm-correctly-synchronize-rss-counters-at-exit-exec.patch

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Konstantin Khlebnikov <khlebnikov@openvz.org>
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/exit.c

index eb127194f19ede2604f532e49ddda1402eded96f..70875a6de8467273e84edfdd47a2cfe9be9890cd 100644 (file)
@@ -960,6 +960,9 @@ void do_exit(long code)
 
        acct_update_integrals(tsk);
 
+       /* Set exit_code before complete_vfork_done() in mm_release() */
+       tsk->exit_code = code;
+
        /* Release mm and sync mm's RSS info before statistics gathering */
        mm_release(tsk, tsk->mm);
 
@@ -975,7 +978,6 @@ void do_exit(long code)
                tty_audit_exit();
        audit_free(tsk);
 
-       tsk->exit_code = code;
        taskstats_exit(tsk, group_dead);
 
        exit_mm(tsk);