History

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.

Alexander Gordeev committed 14 years ago

Commit 4bcdf1d1 parent 540b60e2 files · +16 −13Browse files

Showing the changes to kernel (1 of 2 files). Show all

Unified · Split

kernel/irq/manage.c+11−8
@@ -780,7 +780,7 @@ static int irq_thread(void *data) · 779 unmodified lines
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) · 31 unmodified lines
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 make821 * 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) · 4 unmodified lines
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_ERR842 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 called849 * 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 the855 * 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)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t