vm_fault_tdo_swap_page(struct vm_fault *vmf){ ... page = lookup_swap_cache(entry, vma, vmf->address); ... if (!page) { ... if (!page) { ... }
/* Had to read the page from swap area: Major fault */ ret = VM_FAULT_MAJOR; count_vm_event(PGMAJFAULT); count_memcg_event_mm(vma->vm_mm, PGMAJFAULT); } elseif (PageHWPoison(page)) {
m_fault_tfilemap_fault(struct vm_fault *vmf) { ... /* * Do we have something in the page cache already? */ page = find_get_page(mapping, offset); if (likely(page)) { ... } else { /* No page in the page cache at all */ count_vm_event(PGMAJFAULT); count_memcg_event_mm(vmf->vma->vm_mm, PGMAJFAULT); ret = VM_FAULT_MAJOR; ...
共享内存使用的page需要从磁盘中swap in
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
staticintshmem_swapin_page(struct inode *inode, pgoff_t index, struct page **pagep, enum sgp_type sgp, gfp_t gfp, struct vm_area_struct *vma, vm_fault_t *fault_type) { ... /* Look it up and read it in.. */ page = lookup_swap_cache(swap, NULL, 0); if (!page) { /* Or update major stats only when swapin succeeds?? */ if (fault_type) { *fault_type |= VM_FAULT_MAJOR; count_vm_event(PGMAJFAULT); count_memcg_event_mm(charge_mm, PGMAJFAULT); }