When a process attempts to access data in page which is not in physical memory a page fault will occur. How this is reported by the CPU is architecture specific and system specific code is used to package the event and hand it off to architecture independent portion of the Linux kernel. Whatever architecture Linux is running on, the page fault handler is called.
The relevant Page Table Entry is examined and if it is an invalid entry there are three possible ways of dealing with it:
then the page must be read from
the swap file and the swap_cache and PTE updated.
DAR: Extend - how is the dirty bit set and why, sometimes the
swap cache entry is deleted
A physical page is allocated and the page is read into it from the swap file using the swap file information in the PTE and the information held in the swap_info_struct tree for the swap file. As the page is a shared page, the page tables for all of the processes sharing that virtual memory must be updated to show that the page now exists in physical memory again.