Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932243AbbELIfB (ORCPT ); Tue, 12 May 2015 04:35:01 -0400 Received: from mx2.parallels.com ([199.115.105.18]:49379 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932244AbbELIe5 (ORCPT ); Tue, 12 May 2015 04:34:57 -0400 Date: Tue, 12 May 2015 11:34:38 +0300 From: Vladimir Davydov To: yalin wang CC: Rik van Riel , Hugh Dickins , Christoph Lameter , "Paul E. McKenney" , Peter Zijlstra , Andrew Morton , Minchan Kim , Johannes Weiner , Michal Hocko , Greg Thelen , Michel Lespinasse , David Rientjes , Pavel Emelyanov , Cyrill Gorcunov , , Subject: Re: [RFC] rmap: fix "race" between do_wp_page and shrink_active_list Message-ID: <20150512083438.GB17628@esperanza> References: <1431330677-24476-1-git-send-email-vdavydov@parallels.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1472 Lines: 48 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. Thanks, Vladimir -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/