diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2008-04-30 03:53:04 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 11:29:37 -0400 |
commit | 7a5e873f096e04e6d8719e4ecb7b70d2decca503 (patch) | |
tree | 2d3f7cc6c15e03de02484f9d754a9174ce2fff76 /fs/exec.c | |
parent | fae5fa44f1fd079ffbed8e0add929dd7bbd1347f (diff) |
signals: de_thread: simplify the ->child_reaper switching
Now that we rely on SIGNAL_UNKILLABLE flag, de_thread() doesn't need the nasty
hack to kill the old ->child_reaper during the mt-exec.
This also means we can avoid taking tasklist_lock around zap_other_threads().
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 15 |
1 files changed, 2 insertions, 13 deletions
@@ -766,9 +766,7 @@ static int de_thread(struct task_struct *tsk) | |||
766 | 766 | ||
767 | /* | 767 | /* |
768 | * Kill all other threads in the thread group. | 768 | * Kill all other threads in the thread group. |
769 | * We must hold tasklist_lock to call zap_other_threads. | ||
770 | */ | 769 | */ |
771 | read_lock(&tasklist_lock); | ||
772 | spin_lock_irq(lock); | 770 | spin_lock_irq(lock); |
773 | if (signal_group_exit(sig)) { | 771 | if (signal_group_exit(sig)) { |
774 | /* | 772 | /* |
@@ -776,21 +774,10 @@ static int de_thread(struct task_struct *tsk) | |||
776 | * return so that the signal is processed. | 774 | * return so that the signal is processed. |
777 | */ | 775 | */ |
778 | spin_unlock_irq(lock); | 776 | spin_unlock_irq(lock); |
779 | read_unlock(&tasklist_lock); | ||
780 | return -EAGAIN; | 777 | return -EAGAIN; |
781 | } | 778 | } |
782 | |||
783 | /* | ||
784 | * child_reaper ignores SIGKILL, change it now. | ||
785 | * Reparenting needs write_lock on tasklist_lock, | ||
786 | * so it is safe to do it under read_lock. | ||
787 | */ | ||
788 | if (unlikely(tsk->group_leader == task_child_reaper(tsk))) | ||
789 | task_active_pid_ns(tsk)->child_reaper = tsk; | ||
790 | |||
791 | sig->group_exit_task = tsk; | 779 | sig->group_exit_task = tsk; |
792 | zap_other_threads(tsk); | 780 | zap_other_threads(tsk); |
793 | read_unlock(&tasklist_lock); | ||
794 | 781 | ||
795 | /* Account for the thread group leader hanging around: */ | 782 | /* Account for the thread group leader hanging around: */ |
796 | count = thread_group_leader(tsk) ? 1 : 2; | 783 | count = thread_group_leader(tsk) ? 1 : 2; |
@@ -821,6 +808,8 @@ static int de_thread(struct task_struct *tsk) | |||
821 | schedule(); | 808 | schedule(); |
822 | } | 809 | } |
823 | 810 | ||
811 | if (unlikely(task_child_reaper(tsk) == leader)) | ||
812 | task_active_pid_ns(tsk)->child_reaper = tsk; | ||
824 | /* | 813 | /* |
825 | * The only record we have of the real-time age of a | 814 | * The only record we have of the real-time age of a |
826 | * process, regardless of execs it's done, is start_time. | 815 | * process, regardless of execs it's done, is start_time. |