aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
authorAlexander Gordeev <agordeev@redhat.com>2012-03-09 08:59:59 -0500
committerThomas Gleixner <tglx@linutronix.de>2012-03-09 11:19:09 -0500
commit5234ffb9f74cfa8993d174782bc861dd9b7b5bfb (patch)
treec3933cd6177cde81a99f0bcdadb333b1233e007d /kernel/exit.c
parent05d74efa3c72a5c40b0edeb15856c0230126313b (diff)
genirq: Get rid of unnecessary IRQTF_DIED flag
Currently IRQTF_DIED flag is set when a IRQ thread handler calls do_exit() But also PF_EXITING per process flag gets set when a thread exits. This fix eliminates the duplicate by using PF_EXITING flag. Also, there is a race condition in exit_irq_thread(). In case a thread's bit is cleared in desc->threads_oneshot (and the IRQ line gets unmasked), but before IRQTF_DIED flag is set, a new interrupt might come in and set just cleared bit again, this time forever. This fix throws IRQTF_DIED flag away, eliminating the race as a result. [ tglx: Test THREAD_EXITING first as suggested by Oleg ] Reported-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Link: http://lkml.kernel.org/r/20120309135958.GD2114@dhcp-26-207.brq.redhat.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index 4b4042f9bc6a..752d2c0abd19 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -935,8 +935,6 @@ void do_exit(long code)
935 schedule(); 935 schedule();
936 } 936 }
937 937
938 exit_irq_thread();
939
940 exit_signals(tsk); /* sets PF_EXITING */ 938 exit_signals(tsk); /* sets PF_EXITING */
941 /* 939 /*
942 * tsk->flags are checked in the futex code to protect against 940 * tsk->flags are checked in the futex code to protect against
@@ -945,6 +943,8 @@ void do_exit(long code)
945 smp_mb(); 943 smp_mb();
946 raw_spin_unlock_wait(&tsk->pi_lock); 944 raw_spin_unlock_wait(&tsk->pi_lock);
947 945
946 exit_irq_thread();
947
948 if (unlikely(in_atomic())) 948 if (unlikely(in_atomic()))
949 printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n", 949 printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n",
950 current->comm, task_pid_nr(current), 950 current->comm, task_pid_nr(current),