From: Rik van Riel <riel@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, aarcange@redhat.com, linux-mm@kvack.org
Subject: [PATCH -mm 4/6] always use anon_vma root pointer
Date: Mon, 21 Jun 2010 16:35:30 -0400 [thread overview]
Message-ID: <20100621163530.20c88a7c@annuminas.surriel.com> (raw)
In-Reply-To: <20100621163146.4e4e30cb@annuminas.surriel.com>
From: Andrea Arcangeli <aarcange@redhat.com>
Subject: always use anon_vma root pointer
Always use anon_vma->root pointer instead of anon_vma_chain.prev.
Also optimize the map-paths, if a mapping is already established no need to
overwrite it with root anon-vma list, we can keep the more finegrined anon-vma
and skip the overwrite: see the PageAnon check in !exclusive case. This is also
the optimization that hidden the ksm bug as this tends to make
ksm_might_need_to_copy skip the copy, but only the proper fix to
ksm_might_need_to_copy guarantees not triggering the ksm bug unless ksm is in
use. this is an optimization only...
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Rik van Riel <riel@redhat.com>
diff --git a/mm/rmap.c b/mm/rmap.c
index 006f223..2d9504d 100644
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -776,15 +776,13 @@ static void __page_set_anon_rmap(struct page *page,
* If the page isn't exclusively mapped into this vma,
* we must use the _oldest_ possible anon_vma for the
* page mapping!
- *
- * So take the last AVC chain entry in the vma, which is
- * the deepest ancestor, and use the anon_vma from that.
*/
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;
+ anon_vma = anon_vma->root;
+ } else
+ BUG_ON(PageAnon(page));
anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
page->mapping = (struct address_space *) anon_vma;
next prev parent reply other threads:[~2010-06-21 20:39 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-21 20:31 [PATCH 0/6] further anon_vma fixes & optimizations Rik van Riel
2010-06-21 20:33 ` [PATCH -mm 1/6] mmap: remove unnecessary lock from __vma_link Rik van Riel
2010-06-21 20:33 ` [PATCH -mm 2/6] rmap: always add new vmas at the end Rik van Riel
2010-06-22 21:08 ` Andrew Morton
2010-06-22 21:10 ` Andrea Arcangeli
2010-06-21 20:34 ` [PATCH -mm 3/6] ksm: fix ksm swapin time optimization Rik van Riel
2010-06-23 17:47 ` Andrea Arcangeli
2010-06-21 20:35 ` Rik van Riel [this message]
2010-06-21 20:38 ` [PATCH -mm 5/6] resurrect page_address_in_vma anon_vma check Rik van Riel
2010-06-21 20:39 ` [PATCH -mm 6/6] add anon_vma bug checks Rik van Riel
2010-06-21 21:48 ` [PATCH 0/6] further anon_vma fixes & optimizations Andrea Arcangeli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100621163530.20c88a7c@annuminas.surriel.com \
--to=riel@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®