Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760021AbYFRBt0 (ORCPT ); Tue, 17 Jun 2008 21:49:26 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758870AbYFRBtP (ORCPT ); Tue, 17 Jun 2008 21:49:15 -0400 Received: from fgwmail7.fujitsu.co.jp ([192.51.44.37]:40006 "EHLO fgwmail7.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758293AbYFRBtP (ORCPT ); Tue, 17 Jun 2008 21:49:15 -0400 Date: Wed, 18 Jun 2008 10:54:35 +0900 From: KAMEZAWA Hiroyuki To: KAMEZAWA Hiroyuki Cc: Daisuke Nishimura , Andrew Morton , Rik van Riel , Lee Schermerhorn , Kosaki Motohiro , Nick Piggin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-testers@vger.kernel.org, "hugh@veritas.com" Subject: [PATCH] migration_entry_wait fix. Message-Id: <20080618105435.de10d6bc.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: <20080618101349.db4d5205.kamezawa.hiroyu@jp.fujitsu.com> References: <20080611225945.4da7bb7f.akpm@linux-foundation.org> <20080617163501.7cf411ee.nishimura@mxp.nes.nec.co.jp> <20080618101349.db4d5205.kamezawa.hiroyu@jp.fujitsu.com> Organization: Fujitsu X-Mailer: Sylpheed 2.4.2 (GTK+ 2.10.11; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1814 Lines: 49 On Wed, 18 Jun 2008 10:13:49 +0900 KAMEZAWA Hiroyuki wrote: > + if (!page_cache_get_speculative()) > + goto out; This is obviously buggy....sorry..quilt refresh miss.. == In speculative page cache lookup protocol, page_count(page) is set to 0 while radix-tree modification is going on, truncation, migration, etc... While page migration, a page fault to page under migration should wait unlock_page() and migration_entry_wait() waits for the page from its pte entry. It does get_page() -> wait_on_page_locked() -> put_page() now. In page migration, page_freeze_refs() -> page_unfreeze_refs() is called. Here, page_unfreeze_refs() expects page_count(page) == 0 and panics if page_count(page) != 0. To avoid this, we shouldn't touch page_count() if it is zero. This patch uses page_cache_get_speculative() to avoid the panic. From: Daisuke Nishimura Signed-off-by: Daisuke Nishimura Signed-off-by: KAMEZAWA Hiroyuki --- mm/migrate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Index: test-2.6.26-rc5-mm3/mm/migrate.c =================================================================== --- test-2.6.26-rc5-mm3.orig/mm/migrate.c +++ test-2.6.26-rc5-mm3/mm/migrate.c @@ -243,7 +243,8 @@ void migration_entry_wait(struct mm_stru page = migration_entry_to_page(entry); - get_page(page); + if (!page_cache_get_speculative(page)) + goto out; pte_unmap_unlock(ptep, ptl); wait_on_page_locked(page); put_page(page); -- 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/