aboutsummaryrefslogtreecommitdiffstats
path: root/mm/rmap.c
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2010-10-04 17:23:26 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2010-10-04 17:23:30 -0400
commita9fda02bfc91a281cd812ae15dabe6bfb9574f90 (patch)
treed7be703f341870f15f87a59a63976f650078b4d6 /mm/rmap.c
parentaa3090005d27f3c7fba915ccea36b97b669fa3ab (diff)
parentec706dab290c486837d4a825870ab052bf200279 (diff)
Merge branch 'for_rmk' of git://git.linaro.org/kernel/linux-linaro-next into devel-stable
Diffstat (limited to 'mm/rmap.c')
-rw-r--r--mm/rmap.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/mm/rmap.c b/mm/rmap.c
index f6f0d2dda2ea..9d2ba01bd4f9 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1564,13 +1564,14 @@ static void __hugepage_set_anon_rmap(struct page *page,
1564 struct vm_area_struct *vma, unsigned long address, int exclusive) 1564 struct vm_area_struct *vma, unsigned long address, int exclusive)
1565{ 1565{
1566 struct anon_vma *anon_vma = vma->anon_vma; 1566 struct anon_vma *anon_vma = vma->anon_vma;
1567
1567 BUG_ON(!anon_vma); 1568 BUG_ON(!anon_vma);
1568 if (!exclusive) { 1569
1569 struct anon_vma_chain *avc; 1570 if (PageAnon(page))
1570 avc = list_entry(vma->anon_vma_chain.prev, 1571 return;
1571 struct anon_vma_chain, same_vma); 1572 if (!exclusive)
1572 anon_vma = avc->anon_vma; 1573 anon_vma = anon_vma->root;
1573 } 1574
1574 anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; 1575 anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
1575 page->mapping = (struct address_space *) anon_vma; 1576 page->mapping = (struct address_space *) anon_vma;
1576 page->index = linear_page_index(vma, address); 1577 page->index = linear_page_index(vma, address);
@@ -1581,6 +1582,8 @@ void hugepage_add_anon_rmap(struct page *page,
1581{ 1582{
1582 struct anon_vma *anon_vma = vma->anon_vma; 1583 struct anon_vma *anon_vma = vma->anon_vma;
1583 int first; 1584 int first;
1585
1586 BUG_ON(!PageLocked(page));
1584 BUG_ON(!anon_vma); 1587 BUG_ON(!anon_vma);
1585 BUG_ON(address < vma->vm_start || address >= vma->vm_end); 1588 BUG_ON(address < vma->vm_start || address >= vma->vm_end);
1586 first = atomic_inc_and_test(&page->_mapcount); 1589 first = atomic_inc_and_test(&page->_mapcount);