From: Rik van Riel <riel@redhat.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
kosaki.motohiro@jp.fujitsu.com,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: [BUGFIX][PATCH] Fix false positive BUG_ON in __page_set_anon_rmap
Date: Thu, 22 Jul 2010 09:16:44 -0400 [thread overview]
Message-ID: <4C4844BC.4090709@redhat.com> (raw)
In-Reply-To: <20100722164118.d500b850.kamezawa.hiroyu@jp.fujitsu.com>
On 07/22/2010 03:41 AM, KAMEZAWA Hiroyuki wrote:
> Rik, how do you think ?
>
> ==
> From: KAMEZAWA Hiroyuki<kamezawa.hiroyu@jp.fujitsu.com>
>
> Problem: wrong BUG_ON() in __page_set_anon_rmap().
> Kernel version: mmotm-0719
> Description:
> Even if SwapCache is fully unmapped and mapcount goes down to 0,
> page->mapping is not cleared and will remain on memory until kswapd or some
> finds it. If a thread cause a page fault onto such "unmapped-but-not-discarded"
> swapcache, it will see a swap cache whose mapcount is 0 but page->mapping has a
> valid value.
>
> When it's reused at do_swap_page(), __page_set_anon_rmap() is called with
> "exclusive==1" and hits BUG_ON(). But this BUG_ON() is wrong. Nothing bad
> with rmapping a page which has page->mapping isn't 0.
Yes, you are absolutely right.
Acked-by: Rik van Riel <riel@redhat.com>
> Index: mmotm-2.6.35-0719/mm/rmap.c
> ===================================================================
> --- mmotm-2.6.35-0719.orig/mm/rmap.c
> +++ mmotm-2.6.35-0719/mm/rmap.c
> @@ -783,8 +783,16 @@ static void __page_set_anon_rmap(struct
> if (PageAnon(page))
> return;
> anon_vma = anon_vma->root;
> - } else
> - BUG_ON(PageAnon(page));
> + } 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;
> page->mapping = (struct address_space *) anon_vma;
>
--
All rights reversed
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-07-22 13:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-22 7:41 [BUGFIX][PATCH] Fix false positive BUG_ON in __page_set_anon_rmap KAMEZAWA Hiroyuki
2010-07-22 13:16 ` Rik van Riel [this message]
2010-07-22 17:39 ` 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=4C4844BC.4090709@redhat.com \
--to=riel@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--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;
as well as URLs for NNTP newsgroup(s).