我阅读了一些相关的帖子:
(1)来自Robert Love:http://permalink.gmane.org/gmane.linux.kernel.kernelnewbies/1791
(1)来自Robert Love:http://permalink.gmane.org/gmane.linux.kernel.kernelnewbies/1791
You cannot sleep in an interrupt handler because interrupts do not have a backing
process context, and thus there is nothing to reschedule back into. In other
words, interrupt handlers are not associated with a task, so there is nothing to
"put to sleep" and (more importantly) "nothing to wake up". They must run
atomically.
(2)来自哪个上下文中的软中断和tasklet?
If sleep is allowed, then the linux cannot schedule them and finally cause a
kernel panic with a dequeue_task error. The interrupt context does not even
have a data structure describing the register info, so they can never be scheduled
by linux. If it is designed to have that structure and can be scheduled, the
performance for interrupt handling process will be effected.
据我所知,中断处理程序运行在中断上下文中,并且不能休眠,也就是说,不能像正常进程那样使用后备机制执行上下文切换。
但是,中断处理程序可以被另一个中断打断。当第二个中断处理程序完成工作后,控制流会跳回第一个中断处理程序。
没有正常的上下文切换,如何实现这种“还原”呢?这是不是像普通函数调用一样,所有寄存器和其他相关内容都存储在某个堆栈中?
thread_info
、task_struct
或struct mm
。你需要一个task_struct
来进行调度。中断等可以在thread_info
中作为堆栈免费乘车,以堆叠内核上下文。 - artless noise