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>
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);
tty_audit_exit();
audit_free(tsk);
- tsk->exit_code = code;
taskstats_exit(tsk, group_dead);
exit_mm(tsk);