Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756523AbYFYKFo (ORCPT ); Wed, 25 Jun 2008 06:05:44 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755186AbYFYKFd (ORCPT ); Wed, 25 Jun 2008 06:05:33 -0400 Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:42549 "EHLO fgwmail6.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756193AbYFYKFb (ORCPT ); Wed, 25 Jun 2008 06:05:31 -0400 Date: Wed, 25 Jun 2008 19:04:48 +0900 From: KOSAKI Motohiro To: LKML , linux-mm , Andrew Morton , Lee Schermerhorn , Rik van Riel , Daisuke Nishimura Subject: [-mm][PATCH 4/10] fix migration_entry_wait() for speculative page cache Cc: kosaki.motohiro@jp.fujitsu.com In-Reply-To: <20080625185717.D84C.KOSAKI.MOTOHIRO@jp.fujitsu.com> References: <20080625185717.D84C.KOSAKI.MOTOHIRO@jp.fujitsu.com> Message-Id: <20080625190341.D858.KOSAKI.MOTOHIRO@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.42 [ja] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1907 Lines: 53 = From: KAMEZAWA Hiroyuki 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. Signed-off-by: Daisuke Nishimura Signed-off-by: KAMEZAWA Hiroyuki Signed-off-by: KOSAKI Motohiro --- mm/migrate.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) Index: b/mm/migrate.c =================================================================== --- a/mm/migrate.c +++ b/mm/migrate.c @@ -243,7 +243,15 @@ void migration_entry_wait(struct mm_stru page = migration_entry_to_page(entry); - get_page(page); + /* + * Once radix-tree replacement of page migration started, page_count + * *must* be zero. And, we don't want to call wait_on_page_locked() + * against a page without get_page(). + * So, we use get_page_unless_zero(), here. Even failed, page fault + * will occur again. + */ + if (!get_page_unless_zero(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/