diff --git a/mm/memory.c b/mm/memory.c
index 8adb5b75626462a26dcf4019e0b7725d2a844b64..032f05cd6a2fbe927a77b6917d0e121e4055eec3 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3124,8 +3124,7 @@ static int do_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 		unsigned long address, pte_t *page_table, pmd_t *pmd,
 		unsigned int flags, pte_t orig_pte)
 {
-	pgoff_t pgoff = (((address & PAGE_MASK)
-			- vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
+	pgoff_t pgoff = linear_page_index(vma, address);
 
 	pte_unmap(page_table);
 	/* The VMA was not fully populated on mmap() or missing VM_DONTEXPAND */