Commit 433abed6 authored by Naoya Horiguchi's avatar Naoya Horiguchi Committed by Linus Torvalds

hugetlb, rmap: always use anon_vma root pointer

This patch applies Andrea's fix given by the following patch into hugepage
rmapping code:

  commit 288468c3
  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: default avatarNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
Reviewed-by: default avatarRik van Riel <riel@redhat.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bcf835e5
...@@ -1564,13 +1564,14 @@ static void __hugepage_set_anon_rmap(struct page *page, ...@@ -1564,13 +1564,14 @@ static void __hugepage_set_anon_rmap(struct page *page,
struct vm_area_struct *vma, unsigned long address, int exclusive) struct vm_area_struct *vma, unsigned long address, int exclusive)
{ {
struct anon_vma *anon_vma = vma->anon_vma; struct anon_vma *anon_vma = vma->anon_vma;
BUG_ON(!anon_vma); BUG_ON(!anon_vma);
if (!exclusive) {
struct anon_vma_chain *avc; if (PageAnon(page))
avc = list_entry(vma->anon_vma_chain.prev, return;
struct anon_vma_chain, same_vma); if (!exclusive)
anon_vma = avc->anon_vma; anon_vma = anon_vma->root;
}
anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
page->mapping = (struct address_space *) anon_vma; page->mapping = (struct address_space *) anon_vma;
page->index = linear_page_index(vma, address); page->index = linear_page_index(vma, address);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment