Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752922AbbEQMsb (ORCPT ); Sun, 17 May 2015 08:48:31 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:32952 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752809AbbEQMsV (ORCPT ); Sun, 17 May 2015 08:48:21 -0400 Message-ID: <55588D1C.5060900@gmail.com> Date: Sun, 17 May 2015 20:44:12 +0800 From: yalin User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Vladimir Davydov 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 , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [RFC] rmap: fix "race" between do_wp_page and shrink_active_list References: <1431330677-24476-1-git-send-email-vdavydov@parallels.com> <20150512083438.GB17628@esperanza> In-Reply-To: <20150512083438.GB17628@esperanza> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1532 Lines: 47 > 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 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/