Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756737Ab0DWJDw (ORCPT ); Fri, 23 Apr 2010 05:03:52 -0400 Received: from gir.skynet.ie ([193.1.99.77]:53528 "EHLO gir.skynet.ie" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753593Ab0DWJDt (ORCPT ); Fri, 23 Apr 2010 05:03:49 -0400 Date: Fri, 23 Apr 2010 10:03:29 +0100 From: Mel Gorman To: KAMEZAWA Hiroyuki Cc: Christoph Lameter , Minchan Kim , Andrew Morton , Andrea Arcangeli , Adam Litke , Avi Kivity , David Rientjes , KOSAKI Motohiro , Rik van Riel , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 04/14] mm,migration: Allow the migration of PageSwapCache pages Message-ID: <20100423090329.GI30306@csn.ul.ie> References: <20100422184621.0aaaeb5f.kamezawa.hiroyu@jp.fujitsu.com> <20100422193106.9ffad4ec.kamezawa.hiroyu@jp.fujitsu.com> <20100422195153.d91c1c9e.kamezawa.hiroyu@jp.fujitsu.com> <20100422141404.GA30306@csn.ul.ie> <20100422154003.GC30306@csn.ul.ie> <20100422192923.GH30306@csn.ul.ie> <20100423085203.b43d1cb3.kamezawa.hiroyu@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20100423085203.b43d1cb3.kamezawa.hiroyu@jp.fujitsu.com> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1975 Lines: 50 On Fri, Apr 23, 2010 at 08:52:03AM +0900, KAMEZAWA Hiroyuki wrote: > On Thu, 22 Apr 2010 14:40:46 -0500 (CDT) > Christoph Lameter wrote: > > > On Thu, 22 Apr 2010, Mel Gorman wrote: > > > > > vma_adjust() is updating anon VMA information without any locks taken. > > > In constract, file-backed mappings use the i_mmap_lock. This lack of > > > locking can result in races with page migration. During rmap_walk(), > > > vma_address() can return -EFAULT for an address that will soon be valid. > > > This leaves a dangling migration PTE behind which can later cause a > > > BUG_ON to trigger when the page is faulted in. > > > > Isnt this also a race with reclaim / swap? > > > Yes, it's also race in reclaim/swap ... > page_referenced() > try_to_unmap(). > rmap_walk() <==== we hit this case. > > But above 2 are not considered to be critical. > > I'm not sure how this race affect KSM. > I'm not that familiar with KSM but took a look through. Mostly, accessing the VMA is protected by the mmap_sem with the exception of rmap_walk_ksm. It needs similar protection for accessing the VMA than rmap_walk_anon does. Specifically, this part list_for_each_entry(vmac, &anon_vma->head, same_anon_vma) { vma = vmac->vma; if (rmap_item->address < vma->vm_start || rmap_item->address >= vma->vm_end) continue; needs to acquire the vma->anon_vma lock if it differs or in your case call something similar to vma_address_safe. -- Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab -- 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/