Skip to content

Commit

Permalink
genirq: No need to check IRQTF_DIED before stopping a thread handler
Browse files Browse the repository at this point in the history
Since 6370617 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>
  • Loading branch information
Alexander Gordeev authored and Thomas Gleixner committed Mar 9, 2012
1 parent 4bcdf1d commit 05d74ef
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions kernel/irq/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -1106,8 +1106,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
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:
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 05d74ef

Please sign in to comment.