Moving interrupts to threads
Moving interrupts to threads
Posted Oct 10, 2008 12:10 UTC (Fri) by jzbiciak (guest, #5246)In reply to: Moving interrupts to threads by magnus
Parent article: Moving interrupts to threads
Other than my terse reply (which only answers "why can't I reenable interrupts in my top half?"), I must say, after re-reading the article, I too am not clear on what the difference is here. The current top half looks similar in principle to the quick_check_handler and the current bottom half looks like the handler thread.
Is it just that even more work is pushed out of the top half into the bottom half via action flags in struct irqaction? I guess I don't know enough kernel internals to appreciate the significance of this change, or why the current top half/bottom half structure couldn't do the same. Is this just a cheap event queuing construct that gets around the "can't sleep" aspect of interrupt handler top halves?
Posted Oct 10, 2008 12:55 UTC (Fri)
by jlokier (guest, #52227)
[Link] (2 responses)
So if you have some device which is dominating the machine, like say a network device flooded with tiny packets at line rate, in the old scheme userspace would effectively lock up, and in the new scheme, the network device's handlers will get their fair share of the CPU according to the scheduler.
(This is not a great example because many of the popular network drivers have another mechanism to limit their effect already. But the new scheme is more controlled.)
It also means you can manage the priority of interrupts using thread priorities (RT and non-RT, and "nice"), task control groups, and other things used to manage threads, and they can be dispatched to under-utilised CPUs more efficiently, and interact with thermal and power management.
The need to have quick_check_handler separate from the main handler seems to be due to shared interrupt lines. Without quick_check_handler, multiple devices on the same line would need to share the same handler thread, and interfere with each other.
It's possible to abuse quick_check_handler and write code in the same form as the old top/bottom halves. There are probably some latency-sensitive devices where it's essential to do something more than just acknowledging and disabling the device interrupt. However, that's not the intended way of using it, and if a device is latency sensitive, it should probably use a high RT priority on its handler thread instead. If the thread scheduler is too slow at this, it may be possible to tune this particular path through the scheduler, taking a short cut from irq to task, but retaining the standard scheduling semantics.
Posted Oct 10, 2008 13:21 UTC (Fri)
by jzbiciak (guest, #5246)
[Link] (1 responses)
Did I understand you correctly?
Posted Oct 10, 2008 14:05 UTC (Fri)
by jlokier (guest, #52227)
[Link]
Also threaded interrupts can sleep, take locks and allocate memory as normal threads.
Moving interrupts to threads
Moving interrupts to threads
Moving interrupts to threads