diff options
| author | Tony Lindgren <tony@atomide.com> | 2012-02-17 15:08:20 -0800 |
|---|---|---|
| committer | Tony Lindgren <tony@atomide.com> | 2012-02-17 15:08:20 -0800 |
| commit | b0ee4e394009f02a1d1b166091a19e8b842b4ea4 (patch) | |
| tree | 75e6df725e5402ed6fe9d78f23bf5cf45cfdf9d9 /kernel/exit.c | |
| parent | abe763f2bccbc592d33a3a9c334acaefea022c0a (diff) | |
| parent | 03e4fd6eb25e6b46536ecdb0d1b7d33d46b15480 (diff) | |
Merge branch 'for_3.3/fixes/pm' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-omap-pm into fixes
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 294b1709170..4b4042f9bc6 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1038,6 +1038,22 @@ void do_exit(long code) if (tsk->nr_dirtied) __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied); exit_rcu(); + + /* + * The setting of TASK_RUNNING by try_to_wake_up() may be delayed + * when the following two conditions become true. + * - There is race condition of mmap_sem (It is acquired by + * exit_mm()), and + * - SMI occurs before setting TASK_RUNINNG. + * (or hypervisor of virtual machine switches to other guest) + * As a result, we may become TASK_RUNNING after becoming TASK_DEAD + * + * To avoid it, we have to wait for releasing tsk->pi_lock which + * is held by try_to_wake_up() + */ + smp_mb(); + raw_spin_unlock_wait(&tsk->pi_lock); + /* causes final put_task_struct in finish_task_switch(). */ tsk->state = TASK_DEAD; tsk->flags |= PF_NOFREEZE; /* tell freezer to ignore us */ |
