linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Use linear_page_index() in do_fault()
@ 2016-01-31 12:13 Matthew Wilcox
  2016-02-01 13:06 ` Kirill A. Shutemov
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2016-01-31 12:13 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Matthew Wilcox, linux-mm, linux-kernel, willy

do_fault assumes that PAGE_SIZE is the same as PAGE_CACHE_SIZE.
Use linear_page_index() to calculate pgoff in the correct units.

Signed-off-by: Matthew Wilcox <matthew.r.wilcox@intel.com>
---
 mm/memory.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/memory.c b/mm/memory.c
index 554816b..5224c06 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -3161,8 +3161,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 */
-- 
2.7.0.rc3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-01 20:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-31 12:13 [PATCH] mm: Use linear_page_index() in do_fault() Matthew Wilcox
2016-02-01 13:06 ` Kirill A. Shutemov
2016-02-01 20:44   ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).