Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932352AbWAQSqe (ORCPT ); Tue, 17 Jan 2006 13:46:34 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932212AbWAQSqe (ORCPT ); Tue, 17 Jan 2006 13:46:34 -0500 Received: from atlrel9.hp.com ([156.153.255.214]:57517 "EHLO atlrel9.hp.com") by vger.kernel.org with ESMTP id S932352AbWAQSqd (ORCPT ); Tue, 17 Jan 2006 13:46:33 -0500 Subject: Re: Race in new page migration code? From: Lee Schermerhorn Reply-To: lee.schermerhorn@hp.com To: Christoph Lameter Cc: Hugh Dickins , Nick Piggin , Andrew Morton , Linux Kernel Mailing List , Linux Memory Management List In-Reply-To: References: <20060114155517.GA30543@wotan.suse.de> <20060114181949.GA27382@wotan.suse.de> Content-Type: text/plain Organization: LOSL, Nashua Date: Tue, 17 Jan 2006 13:46:11 -0500 Message-Id: <1137523571.5245.9.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 (2.0.4-7) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2038 Lines: 55 On Tue, 2006-01-17 at 09:29 -0800, Christoph Lameter wrote: > On Mon, 16 Jan 2006, Hugh Dickins wrote: > > > Hmm, that battery of unusual tests at the start of migrate_page_add > > is odd: the tests don't quite match the comment, and it isn't clear > > what reasoning lies behind the comment anyway. > > Here is patch to clarify the test. I'd be glad if someone could make > the tests more accurate. This ultimately comes down to a concept of > ownership of page by a process / mm_struct that we have to approximate. > > === > > Explain the complicated check in migrate_page_add by putting the logic > into a separate function migration_check. This way any enhancements can > be easily added. > > Signed-off-by: Christoph Lameter > > Index: linux-2.6.15/mm/mempolicy.c > =================================================================== > --- linux-2.6.15.orig/mm/mempolicy.c 2006-01-14 10:56:28.000000000 -0800 > +++ linux-2.6.15/mm/mempolicy.c 2006-01-17 09:24:20.000000000 -0800 > @@ -551,6 +551,37 @@ out: > return rc; > } > > +static inline int migration_check(struct mm_struct *mm, struct page *page) > +{ > + /* > + * If the page has no mapping then we do not track reverse mappings. > + * Thus the page is not mapped by other mms, so its safe to move. > + */ > + if (page->mapping) should this be "if (!page->mapping)" ??? > + return 1; > + > - if ((flags & MPOL_MF_MOVE_ALL) || !page->mapping || PageAnon(page) || like here ......................................^^^^^^^^^^^^^^ > - mapping_writably_mapped(page->mapping) || > - single_mm_mapping(vma->vm_mm, page->mapping)) > + if ((flags & MPOL_MF_MOVE_ALL) || migration_check(vma->vm_mm, page)) > if (isolate_lru_page(page) == 1) > list_add(&page->lru, pagelist); > } Lee - 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/