From d5e0458074a6400f08ee23c873199f06bfae88bf Mon Sep 17 00:00:00 2001 From: Andrea Arcangeli Date: Mon, 9 Aug 2010 17:19:09 -0700 Subject: [PATCH] --- yaml --- r: 207235 b: refs/heads/master c: 288468c334e98aacbb7e2fb8bde6bc1adcd55e05 h: refs/heads/master i: 207233: 8e1c2c7f228bfb1d2f7da980b3aaf7f244b63044 207231: 4d730c35200c4b9a0ce31c9b95cb1a2030ad2139 v: v3 --- [refs] | 2 +- trunk/mm/rmap.c | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 1a66a63576e4..1e481a618802 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ba6f0ff3981e6263ab81ac512f04cca55b85ec81 +refs/heads/master: 288468c334e98aacbb7e2fb8bde6bc1adcd55e05 diff --git a/trunk/mm/rmap.c b/trunk/mm/rmap.c index dce74a9efdd6..f5d6799b8a74 100644 --- a/trunk/mm/rmap.c +++ b/trunk/mm/rmap.c @@ -767,14 +767,20 @@ 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 { + /* + * In this case, swapped-out-but-not-discarded swap-cache + * is remapped. So, no need to update page->mapping here. + * We convice anon_vma poitned by page->mapping is not obsolete + * because vma->anon_vma is necessary to be a family of it. + */ + if (PageAnon(page)) + return; } anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;