Swap in must take place when a process attempts to address a page within its address space that has been swapped out to disk. The Page Fault exception handler triggers a swap-in operation when the following conditions occur (see Section 8.4.2):
• The page including the address that caused the exception is a valid one—that is, it belongs to a memory region of the current process.
• The page is not present in memory—that is, the Present flag in the Page Table entry is cleared.
• The Page Table entry associated with the page is not null, which means it contains a swapped-out page identifier.
As described in Section 8.4.3, the handle_pte_fault( ) function, invoked by the do_page_fault( ) exception handler, checks whether the Page Table entry is non-null. If so, it invokes a quite handy do_swap_page( ) function to swap in the page required.
Was this article helpful?