gpt4 book ai didi

memory-management - 页面故障会导致故障处理重新安排吗?

转载 作者:行者123 更新时间:2023-12-04 04:12:39 24 4
gpt4 key购买 nike

在Linux中,当进程尝试访问没有当前物理映射的页面(缺少页面表条目)时,将生成页面错误(由CPU)。这将导致Linux的页面错误处理程序被调用。如果此故障是“严重”故障,则意味着Linux必须从交换设备读取页面,在这种情况下,处理程序必须从实际磁盘读取。由于从磁盘读取是异步的(submit_bio),这会导致进程重新计划吗? (并在I/O完成后醒来吗?)

如果确实发生了重新计划,则对“schedule()”的调用在哪里?读取mm/swap_state.c中的代码并不能为我提供何时(或是否)发生这种情况的线索。

最佳答案

如果页面不在物理内存中,则该过程会阻塞,直到读取该页面为止,我认为您在错误的位置查找时间表应该在页面错误处理程序或其调用的任何函数中。在section 9.4. "Page Fault Exception Handler" of "Understanding the Linux Kernel" book中有更多信息,我引用:

The handle_mm_fault( ) function returns VM_FAULT_MINOR or VM_FAULT_MAJOR if it succeeded in allocating a new page frame for the process. The value VM_FAULT_MINOR indicates that the Page Fault has been handled without blocking the current process; this kind of Page Fault is called minor fault. The value VM_FAULT_MAJOR indicates that the Page Fault forced the current process to sleep

关于memory-management - 页面故障会导致故障处理重新安排吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13441732/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com