aboutsummaryrefslogtreecommitdiffstats
path: root/mm/rmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/rmap.c')
-rw-r--r--mm/rmap.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/mm/rmap.c b/mm/rmap.c
index 7e975ca24c78..450f5241b5a5 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -445,16 +445,12 @@ void page_add_anon_rmap(struct page *page,
445 445
446 if (atomic_inc_and_test(&page->_mapcount)) { 446 if (atomic_inc_and_test(&page->_mapcount)) {
447 struct anon_vma *anon_vma = vma->anon_vma; 447 struct anon_vma *anon_vma = vma->anon_vma;
448 pgoff_t index;
449 448
450 BUG_ON(!anon_vma); 449 BUG_ON(!anon_vma);
451 anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; 450 anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
452 page->mapping = (struct address_space *) anon_vma; 451 page->mapping = (struct address_space *) anon_vma;
453 452
454 index = (address - vma->vm_start) >> PAGE_SHIFT; 453 page->index = linear_page_index(vma, address);
455 index += vma->vm_pgoff;
456 index >>= PAGE_CACHE_SHIFT - PAGE_SHIFT;
457 page->index = index;
458 454
459 inc_page_state(nr_mapped); 455 inc_page_state(nr_mapped);
460 } 456 }