summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2010-09-10 13:23:03 +0900
committerLinus Torvalds <torvalds@linux-foundation.org>2010-09-23 17:29:18 -0700
commit433abed6c6f76ca079a9564f2a1a51fd28ebe0ca (patch)
treed654c3331c1910fdae732c6576d1f023b0cfae7d /mm
parentbcf835e52e0974b2e2e056b190dd66372b28cfce (diff)
downloadlinux-3.10-433abed6c6f76ca079a9564f2a1a51fd28ebe0ca.tar.gz
linux-3.10-433abed6c6f76ca079a9564f2a1a51fd28ebe0ca.tar.bz2
linux-3.10-433abed6c6f76ca079a9564f2a1a51fd28ebe0ca.zip
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>
Diffstat (limited to 'mm')
-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,
struct vm_area_struct *vma, unsigned long address, int exclusive)
{
struct anon_vma *anon_vma = vma->anon_vma;
+
BUG_ON(!anon_vma);
- if (!exclusive) {
- struct anon_vma_chain *avc;
- avc = list_entry(vma->anon_vma_chain.prev,
- struct anon_vma_chain, same_vma);
- anon_vma = avc->anon_vma;
- }
+
+ if (PageAnon(page))
+ return;
+ if (!exclusive)
+ anon_vma = anon_vma->root;
+
anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
page->mapping = (struct address_space *) anon_vma;
page->index = linear_page_index(vma, address);