All of lore.kernel.org
 help / color / mirror / Atom feed
From: yalin <yalin.wang2010@gmail.com>
To: Vladimir Davydov <vdavydov@parallels.com>
Cc: Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>,
	Christoph Lameter <cl@linux.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@suse.cz>, Greg Thelen <gthelen@google.com>,
	Michel Lespinasse <walken@google.com>,
	David Rientjes <rientjes@google.com>,
	Pavel Emelyanov <xemul@parallels.com>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] rmap: fix "race" between do_wp_page and shrink_active_list
Date: Sun, 17 May 2015 20:44:12 +0800	[thread overview]
Message-ID: <55588D1C.5060900@gmail.com> (raw)
In-Reply-To: <20150512083438.GB17628@esperanza>


> On Mon, May 11, 2015 at 04:59:27PM +0800, yalin wang wrote:
>> i am confused about your analysis ,
>> for the race stack:
>>
>> CPU0                          CPU1
>>
>>     ----                          ----
>>
>>     do_wp_page                    shrink_active_list
>>
>>      lock_page                     page_referenced
>>
>>                                     PageAnon->yes, so skip trylock_page
>>
>>      page_move_anon_rmap
>>
>>       page->mapping = anon_vma
>>
>>                                     rmap_walk
>>
>>                                      PageAnon->no
>>
>>                                      rmap_walk_file
>>
>>                                       BUG
>>
>>       page->mapping += PAGE_MAPPING_ANON
>>
>> the page should must change from PageAnon() to !PageAnon() when crash happened.
>> but page_move_anon_rmap() is doing change a page from !PageAnon()
>> (swapcache page) to PageAnon() ,
> A swapcache page is not necessarily !PageAnon. In do_wp_page() old_page
> *is* PageAnon. It may or may not be on the swapcache though, which does
> not really matter.
>
>> how does this race condition crash happened ?
> It never happened. It might theoretically happen due to a compiler
> "optimization" I described above.
i see,
Thanks for your explanation!

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: yalin <yalin.wang2010@gmail.com>
To: Vladimir Davydov <vdavydov@parallels.com>
Cc: Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>,
	Christoph Lameter <cl@linux.com>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Hocko <mhocko@suse.cz>, Greg Thelen <gthelen@google.com>,
	Michel Lespinasse <walken@google.com>,
	David Rientjes <rientjes@google.com>,
	Pavel Emelyanov <xemul@parallels.com>,
	Cyrill Gorcunov <gorcunov@openvz.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] rmap: fix "race" between do_wp_page and shrink_active_list
Date: Sun, 17 May 2015 20:44:12 +0800	[thread overview]
Message-ID: <55588D1C.5060900@gmail.com> (raw)
In-Reply-To: <20150512083438.GB17628@esperanza>


> On Mon, May 11, 2015 at 04:59:27PM +0800, yalin wang wrote:
>> i am confused about your analysis ,
>> for the race stack:
>>
>> CPU0                          CPU1
>>
>>     ----                          ----
>>
>>     do_wp_page                    shrink_active_list
>>
>>      lock_page                     page_referenced
>>
>>                                     PageAnon->yes, so skip trylock_page
>>
>>      page_move_anon_rmap
>>
>>       page->mapping = anon_vma
>>
>>                                     rmap_walk
>>
>>                                      PageAnon->no
>>
>>                                      rmap_walk_file
>>
>>                                       BUG
>>
>>       page->mapping += PAGE_MAPPING_ANON
>>
>> the page should must change from PageAnon() to !PageAnon() when crash happened.
>> but page_move_anon_rmap() is doing change a page from !PageAnon()
>> (swapcache page) to PageAnon() ,
> A swapcache page is not necessarily !PageAnon. In do_wp_page() old_page
> *is* PageAnon. It may or may not be on the swapcache though, which does
> not really matter.
>
>> how does this race condition crash happened ?
> It never happened. It might theoretically happen due to a compiler
> "optimization" I described above.
i see,
Thanks for your explanation!


  reply	other threads:[~2015-05-17 12:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-11  7:51 [RFC] rmap: fix "race" between do_wp_page and shrink_active_list Vladimir Davydov
2015-05-11  7:51 ` Vladimir Davydov
2015-05-11  8:59 ` yalin wang
2015-05-11  8:59   ` yalin wang
2015-05-12  8:34   ` Vladimir Davydov
2015-05-12  8:34     ` Vladimir Davydov
2015-05-17 12:44     ` yalin [this message]
2015-05-17 12:44       ` yalin
2015-05-11  9:36 ` Kirill A. Shutemov
2015-05-11  9:36   ` Kirill A. Shutemov
2015-05-12  9:27   ` Vladimir Davydov
2015-05-12  9:27     ` Vladimir Davydov
2015-05-11 14:24 ` Paul E. McKenney
2015-05-11 14:24   ` Paul E. McKenney
2015-05-12  9:31   ` Vladimir Davydov
2015-05-12  9:31     ` Vladimir Davydov

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=55588D1C.5060900@gmail.com \
    --to=yalin.wang2010@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=gorcunov@openvz.org \
    --cc=gthelen@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.cz \
    --cc=minchan@kernel.org \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=rientjes@google.com \
    --cc=vdavydov@parallels.com \
    --cc=walken@google.com \
    --cc=xemul@parallels.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.