diff options
Diffstat (limited to 'mm/rmap.c')
-rw-r--r-- | mm/rmap.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -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); |