- 论坛徽章:
- 11
|
understanding the linux kernel 上:
The price to pay for allowing nested kernel control paths is that an interrupt handler must never block, that is, no process switch can take place while an interrupt handler is running. In fact, all the data needed to resume a nested kernel path is stored in the kernel mode stack, which is tightly bound to the current process.
但还是没给出一个有力的理由说明为什么不允许任务切换; 只说了一个返回到被嵌套的内核路径的相关信息都保存在当前任务内核栈上, 因此与当前任务紧密绑定的 经不起推敲的理由。
下文说 Page Fault 可以在内核中发生, 而且 Page Fault 允许任务切换, 因此存在一个内核路径中触发 Page Fault, do_page_fault又引起任务切换的可能; 那么很显然, 返回被 Page Fault 中断的内核路径相关信息应该也报存在当前内核栈中, 那它怎么又允许了?
我觉得所谓不允许任务切换, 根由在于中断的性质本身就是当前任务不相关的, 因此因中断导致任务切换也显得无足够理由, 而且, 任务切换后返回, 说不定就返回用户空间了, 造成一个普通进程抢占中断的结果, 于理不符; 还有就是中断往往是关中断的, 除非任务切换后你接着打开中断, 否则就是返回用户空间后执行然而中断仍然关闭着。
但以上所有, 其实都是实现的考虑而不是什么限制, 从技术上说, 似乎没有理由说嵌套中断就一定不能任务切换
不知理解是否正确 |
|