genirq: No need to check IRQTF_DIED before stopping a thread handler
authorAlexander Gordeev <agordeev@redhat.com>
Fri, 9 Mar 2012 13:59:40 +0000 (14:59 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 9 Mar 2012 16:19:08 +0000 (17:19 +0100)
Since 63706172f332fd3f6e7458ebfb35fa6de9c21dc5 kthread_stop() is not
afraid of dead kernel threads. So no need to check if a thread is
alive before stopping it. These checks still were racy.

Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Alexander Gordeev <agordeev@redhat.com>
Link: http://lkml.kernel.org/r/20120309135939.GC2114@dhcp-26-207.brq.redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
kernel/irq/manage.c

index 0fa3ce998ecbfd57fc0fa2b1c3c17595c9b6f037..3feab4ab6877685c2818fbd7139894db2cb09718 100644 (file)
@@ -1106,8 +1106,7 @@ out_thread:
                struct task_struct *t = new->thread;
 
                new->thread = NULL;
-               if (likely(!test_bit(IRQTF_DIED, &new->thread_flags)))
-                       kthread_stop(t);
+               kthread_stop(t);
                put_task_struct(t);
        }
 out_mput:
@@ -1217,8 +1216,7 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
 #endif
 
        if (action->thread) {
-               if (!test_bit(IRQTF_DIED, &action->thread_flags))
-                       kthread_stop(action->thread);
+               kthread_stop(action->thread);
                put_task_struct(action->thread);
        }