diff options
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 294b1709170d..4b4042f9bc6a 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -1038,6 +1038,22 @@ void do_exit(long code) | |||
1038 | if (tsk->nr_dirtied) | 1038 | if (tsk->nr_dirtied) |
1039 | __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied); | 1039 | __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied); |
1040 | exit_rcu(); | 1040 | exit_rcu(); |
1041 | |||
1042 | /* | ||
1043 | * The setting of TASK_RUNNING by try_to_wake_up() may be delayed | ||
1044 | * when the following two conditions become true. | ||
1045 | * - There is race condition of mmap_sem (It is acquired by | ||
1046 | * exit_mm()), and | ||
1047 | * - SMI occurs before setting TASK_RUNINNG. | ||
1048 | * (or hypervisor of virtual machine switches to other guest) | ||
1049 | * As a result, we may become TASK_RUNNING after becoming TASK_DEAD | ||
1050 | * | ||
1051 | * To avoid it, we have to wait for releasing tsk->pi_lock which | ||
1052 | * is held by try_to_wake_up() | ||
1053 | */ | ||
1054 | smp_mb(); | ||
1055 | raw_spin_unlock_wait(&tsk->pi_lock); | ||
1056 | |||
1041 | /* causes final put_task_struct in finish_task_switch(). */ | 1057 | /* causes final put_task_struct in finish_task_switch(). */ |
1042 | tsk->state = TASK_DEAD; | 1058 | tsk->state = TASK_DEAD; |
1043 | tsk->flags |= PF_NOFREEZE; /* tell freezer to ignore us */ | 1059 | tsk->flags |= PF_NOFREEZE; /* tell freezer to ignore us */ |