aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2010-09-10 00:23:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-09-23 20:29:18 -0400
commit433abed6c6f76ca079a9564f2a1a51fd28ebe0ca (patch)
treed654c3331c1910fdae732c6576d1f023b0cfae7d
parentbcf835e52e0974b2e2e056b190dd66372b28cfce (diff)
hugetlb, rmap: always use anon_vma root pointer
This patch applies Andrea's fix given by the following patch into hugepage rmapping code: commit 288468c334e98aacbb7e2fb8bde6bc1adcd55e05 Author: Andrea Arcangeli <aarcange@redhat.com> Date: Mon Aug 9 17:19:09 2010 -0700 This patch uses anon_vma->root and avoids unnecessary overwriting when anon_vma is already set up. Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Acked-by: Andrea Arcangeli <aarcange@redhat.com> Reviewed-by: Rik van Riel <riel@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/rmap.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/mm/rmap.c b/mm/rmap.c
index f6f0d2dda2e..2854857fd63 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);