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
780780 handler_fn = irq_thread_fn;
781781
782782 sched_setscheduler(current, SCHED_FIFO, &param);
783− current->irqaction = action;
783+ current->irq_thread = 1;
784784
785785 while (!irq_wait_for_interrupt(action)) {
786786
@@ -818,10 +818,10 @@ static int irq_thread(void *data) · 31 unmodified lines
818818 irq_finalize_oneshot(desc, action, true);
819819
820820 /*
821− * Clear irqaction. Otherwise exit_irq_thread() would make
821+ * Clear irq_thread. Otherwise exit_irq_thread() would make
822822 * fuzz about an active irq thread going into nirvana.
823823 */
824− current->irqaction = NULL;
824+ current->irq_thread = 0;
825825 return 0;
826826 }
827827
@@ -832,27 +832,30 @@ void exit_irq_thread(void) · 4 unmodified lines
832832 {
833833 struct task_struct *tsk = current;
834834 struct irq_desc *desc;
835+ struct irqaction *action;
835836
836− if (!tsk->irqaction)
837+ if (!tsk->irq_thread)
837838 return;
838839
840+ action = kthread_data(tsk);
841+
839842 printk(KERN_ERR
840843 "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);
842845
843− desc = irq_to_desc(tsk->irqaction->irq);
846+ desc = irq_to_desc(action->irq);
844847
845848 /*
846849 * Prevent a stale desc->threads_oneshot. Must be called
847850 * before setting the IRQTF_DIED flag.
848851 */
849− irq_finalize_oneshot(desc, tsk->irqaction, true);
852+ irq_finalize_oneshot(desc, action, true);
850853
851854 /*
852855 * Set the THREAD DIED flag to prevent further wakeups of the
853856 * soon to be gone threaded handler.
854857 */
855− set_bit(IRQTF_DIED, &tsk->irqaction->flags);
858+ set_bit(IRQTF_DIED, &action->flags);
856859 }
857860
858861 static 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