exit: move taskstats_tgid_free() from __exit_signal() to free_signal_struct()
authorOleg Nesterov <[email protected]>
Wed, 26 May 2010 21:43:20 +0000 (14:43 -0700)
committerLinus Torvalds <[email protected]>
Thu, 27 May 2010 16:12:46 +0000 (09:12 -0700)
Move taskstats_tgid_free() from __exit_signal() to free_signal_struct().

This way signal->stats never points to nowhere and we can read ->stats
lockless.

Signed-off-by: Oleg Nesterov <[email protected]>
Cc: Balbir Singh <[email protected]>
Cc: Roland McGrath <[email protected]>
Cc: Veaceslav Falico <[email protected]>
Cc: Stanislaw Gruszka <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/exit.c
kernel/fork.c

index 3602f468e3a0c277030dfdaf95c6665ea77df47a..357d443d5a00024a0ec768889cff2c54c317aee6 100644 (file)
@@ -144,7 +144,6 @@ static void __exit_signal(struct task_struct *tsk)
        clear_tsk_thread_flag(tsk,TIF_SIGPENDING);
        if (group_dead) {
                flush_sigqueue(&sig->shared_pending);
-               taskstats_tgid_free(sig);
                tty_kref_put(tty);
        }
 }
index 58f8611b1ac6cc8dbab656fff0e5f5add7e35294..7701470ea1b8222eb5990a016b85fc8526d3d55f 100644 (file)
@@ -167,6 +167,7 @@ EXPORT_SYMBOL(free_task);
 
 static inline void free_signal_struct(struct signal_struct *sig)
 {
+       taskstats_tgid_free(sig);
        kmem_cache_free(signal_cachep, sig);
 }