diff options
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 091a78be3b09..1e1d913914c0 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -725,7 +725,7 @@ static void check_stack_usage(void) | |||
725 | static inline void check_stack_usage(void) {} | 725 | static inline void check_stack_usage(void) {} |
726 | #endif | 726 | #endif |
727 | 727 | ||
728 | void do_exit(long code) | 728 | void __noreturn do_exit(long code) |
729 | { | 729 | { |
730 | struct task_struct *tsk = current; | 730 | struct task_struct *tsk = current; |
731 | int group_dead; | 731 | int group_dead; |
@@ -882,29 +882,7 @@ void do_exit(long code) | |||
882 | exit_rcu(); | 882 | exit_rcu(); |
883 | TASKS_RCU(__srcu_read_unlock(&tasks_rcu_exit_srcu, tasks_rcu_i)); | 883 | TASKS_RCU(__srcu_read_unlock(&tasks_rcu_exit_srcu, tasks_rcu_i)); |
884 | 884 | ||
885 | /* | 885 | do_task_dead(); |
886 | * The setting of TASK_RUNNING by try_to_wake_up() may be delayed | ||
887 | * when the following two conditions become true. | ||
888 | * - There is race condition of mmap_sem (It is acquired by | ||
889 | * exit_mm()), and | ||
890 | * - SMI occurs before setting TASK_RUNINNG. | ||
891 | * (or hypervisor of virtual machine switches to other guest) | ||
892 | * As a result, we may become TASK_RUNNING after becoming TASK_DEAD | ||
893 | * | ||
894 | * To avoid it, we have to wait for releasing tsk->pi_lock which | ||
895 | * is held by try_to_wake_up() | ||
896 | */ | ||
897 | smp_mb(); | ||
898 | raw_spin_unlock_wait(&tsk->pi_lock); | ||
899 | |||
900 | /* causes final put_task_struct in finish_task_switch(). */ | ||
901 | tsk->state = TASK_DEAD; | ||
902 | tsk->flags |= PF_NOFREEZE; /* tell freezer to ignore us */ | ||
903 | schedule(); | ||
904 | BUG(); | ||
905 | /* Avoid "noreturn function does return". */ | ||
906 | for (;;) | ||
907 | cpu_relax(); /* For when BUG is null */ | ||
908 | } | 886 | } |
909 | EXPORT_SYMBOL_GPL(do_exit); | 887 | EXPORT_SYMBOL_GPL(do_exit); |
910 | 888 | ||