genirq: reimplement exit_irq_thread() hook via task_work_add()
authorOleg Nesterov <[email protected]>
Fri, 11 May 2012 00:59:08 +0000 (10:59 +1000)
committerAl Viro <[email protected]>
Thu, 24 May 2012 02:11:12 +0000 (22:11 -0400)
commit4d1d61a6b203d957777d73fcebf19d90b038b5b2
tree8b597fa00168ee59e3abf5ec8cf4e92f8fd28d8a
parente73f8959af0439d114847eab5a8a5ce48f1217c4
genirq: reimplement exit_irq_thread() hook via task_work_add()

exit_irq_thread() and task->irq_thread are needed to handle the unexpected
(and unlikely) exit of irq-thread.

We can use task_work instead and make this all private to
kernel/irq/manage.c, cleanup plus micro-optimization.

1. rename exit_irq_thread() to irq_thread_dtor(), make it
   static, and move it up before irq_thread().

2. change irq_thread() to do task_work_add(irq_thread_dtor)
   at the start and task_work_cancel() before return.

   tracehook_notify_resume() can never play with kthreads,
   only do_exit()->exit_task_work() can call the callback
   and this is what we want.

3. remove task_struct->irq_thread and the special hook
   in do_exit().

Signed-off-by: Oleg Nesterov <[email protected]>
Reviewed-by: Thomas Gleixner <[email protected]>
Cc: David Howells <[email protected]>
Cc: Richard Kuo <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Alexander Gordeev <[email protected]>
Cc: Chris Zankel <[email protected]>
Cc: David Smith <[email protected]>
Cc: "Frank Ch. Eigler" <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Larry Woodman <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Tejun Heo <[email protected]>
Cc: Ingo Molnar <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Al Viro <[email protected]>
include/linux/interrupt.h
include/linux/sched.h
kernel/exit.c
kernel/irq/manage.c