From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Fri, 15 Jun 2007 01:02:17 +0900 From: KAMEZAWA Hiroyuki Subject: Re: [RFC] memory unplug v5 [1/6] migration by kernel Message-Id: <20070615010217.62908da3.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: References: <20070614155630.04f8170c.kamezawa.hiroyu@jp.fujitsu.com> <20070614155929.2be37edb.kamezawa.hiroyu@jp.fujitsu.com> <20070614161146.5415f493.kamezawa.hiroyu@jp.fujitsu.com> <20070614164128.42882f74.kamezawa.hiroyu@jp.fujitsu.com> <20070614172936.12b94ad7.kamezawa.hiroyu@jp.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: Christoph Lameter Cc: linux-mm@kvack.org, mel@csn.ul.ie, y-goto@jp.fujitsu.com, hugh@veritas.com List-ID: On Thu, 14 Jun 2007 07:19:19 -0700 (PDT) Christoph Lameter wrote: > On Thu, 14 Jun 2007, KAMEZAWA Hiroyuki wrote: > > > But...during discussion with you, I found anon_vma is now freed by RCU... > > > > Ugh, then, what I have to do is rcu_read_lock() -> rcu_read_unlock() while > > migrating anon ptes. If we can rcu read lock here, we don't need dummy_vma. > > How about this ? > > Hmmmm... Looks good. Maybe take the RCU lock unconditionally? Is there a > problem if we do so? Then the patch becomes very small and it looks > cleaner. Ok, maybe no problem if "if" is removed. > > Is there an issue with calling try_to_unmap for an unmapped page? We check > in try_to_unmap if the pte is valid. If it was unmapped then try_to_unmap > will fail anyways. > I met following case. --- CPU 0 CPU 1 do_swap_page() -> read_swap_cache_async() -> # alloc new page # page is added to swapcache # page is locked here. # added to LRU <- we find this page because of PG_lru # start asynchrous read I/O lock_page() # page is unlocked here we acquire the lock. -> lock_page() wait.... unmap_and_move() is called. try_to_unmap() is called. PageAnon() returns 0. beacause the page is not added to rmap yet. page->mapping is NULL, here. try_to_unmap_file() is called. try_to_unmap_file() touches NULL pointer. -- An unmapped swapcache page, which is just added to LRU, may be accessed via migrate_page(). But page->mapping is NULL yet. Hmm, should I add following check instead of page_mapped() ? -- if (likely(page->mapping)) try_to_unmap(page,1) -- Note: Because the page's page_count() is not migratable,(do_swap_page() has one ref.) this migration will fail with -EAGAIN. Thanks, -Kame -- 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: email@kvack.org