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
do_swap_page( ) function acts on the
Memory descriptor address of the process that caused the Page Fault exception
Memory region descriptor address of the region that includes
Linear address that causes the exception
Address of the Page Table entry that maps
Content of the Page Table entry that maps
Flag denoting whether the attempted access was a read or a write
Contrary to other functions,
do_swap_page( ) never returns 0. It returns 1 if the page is already in the swap cache (minor fault), 2 if the page ...