aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq
diff options
context:
space:
mode:
authorAlexander Gordeev <agordeev@redhat.com>2012-03-09 08:59:26 -0500
committerThomas Gleixner <tglx@linutronix.de>2012-03-09 11:19:08 -0500
commit4bcdf1d0b652bc33d52f2322b77463e4dc58abf8 (patch)
tree2a8ecf0f6ef1d0c85a4553cb1d1c7dc74706488a /kernel/irq
parent540b60e24f3f4781d80e47122f0c4486a03375b8 (diff)
genirq: Get rid of unnecessary irqaction field in task_struct
When a new thread handler is created, an irqaction is passed to it as data. Not only that irqaction is stored in task_struct by the handler for later use, but also a structure associated with the kernel thread keeps this value as long as the thread exists. This fix kicks irqaction out off task_struct. Yes, I introduce new bit field. But it allows not only to eliminate the duplicate, but also shortens size of task_struct. Reported-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Alexander Gordeev <agordeev@redhat.com> Link: http://lkml.kernel.org/r/20120309135925.GB2114@dhcp-26-207.brq.redhat.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/manage.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index c0730ad8a117..0fa3ce998ecb 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -780,7 +780,7 @@ static int irq_thread(void *data)
780 handler_fn = irq_thread_fn; 780 handler_fn = irq_thread_fn;
781 781
782 sched_setscheduler(current, SCHED_FIFO, &param); 782 sched_setscheduler(current, SCHED_FIFO, &param);
783 current->irqaction = action; 783 current->irq_thread = 1;
784 784
785 while (!irq_wait_for_interrupt(action)) { 785 while (!irq_wait_for_interrupt(action)) {
786 786
@@ -818,10 +818,10 @@ static int irq_thread(void *data)
818 irq_finalize_oneshot(desc, action, true); 818 irq_finalize_oneshot(desc, action, true);
819 819
820 /* 820 /*
821 * Clear irqaction. Otherwise exit_irq_thread() would make 821 * Clear irq_thread. Otherwise exit_irq_thread() would make
822 * fuzz about an active irq thread going into nirvana. 822 * fuzz about an active irq thread going into nirvana.
823 */ 823 */
824 current->irqaction = NULL; 824 current->irq_thread = 0;
825 return 0; 825 return 0;
826} 826}
827 827
@@ -832,27 +832,30 @@ void exit_irq_thread(void)
832{ 832{
833 struct task_struct *tsk = current; 833 struct task_struct *tsk = current;
834 struct irq_desc *desc; 834 struct irq_desc *desc;
835 struct irqaction *action;
835 836
836 if (!tsk->irqaction) 837 if (!tsk->irq_thread)
837 return; 838 return;
838 839
840 action = kthread_data(tsk);
841
839 printk(KERN_ERR 842 printk(KERN_ERR
840 "exiting task \"%s\" (%d) is an active IRQ thread (irq %d)\n", 843 "exiting task \"%s\" (%d) is an active IRQ thread (irq %d)\n",
841 tsk->comm ? tsk->comm : "", tsk->pid, tsk->irqaction->irq); 844 tsk->comm ? tsk->comm : "", tsk->pid, action->irq);
842 845
843 desc = irq_to_desc(tsk->irqaction->irq); 846 desc = irq_to_desc(action->irq);
844 847
845 /* 848 /*
846 * Prevent a stale desc->threads_oneshot. Must be called 849 * Prevent a stale desc->threads_oneshot. Must be called
847 * before setting the IRQTF_DIED flag. 850 * before setting the IRQTF_DIED flag.
848 */ 851 */
849 irq_finalize_oneshot(desc, tsk->irqaction, true); 852 irq_finalize_oneshot(desc, action, true);
850 853
851 /* 854 /*
852 * Set the THREAD DIED flag to prevent further wakeups of the 855 * Set the THREAD DIED flag to prevent further wakeups of the
853 * soon to be gone threaded handler. 856 * soon to be gone threaded handler.
854 */ 857 */
855 set_bit(IRQTF_DIED, &tsk->irqaction->flags); 858 set_bit(IRQTF_DIED, &action->flags);
856} 859}
857 860
858static void irq_setup_forced_threading(struct irqaction *new) 861static void irq_setup_forced_threading(struct irqaction *new)