From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx112.postini.com [74.125.245.112]) by kanga.kvack.org (Postfix) with SMTP id 4F5226B004F for ; Wed, 7 Dec 2011 22:25:03 -0500 (EST) Received: by yenq10 with SMTP id q10so1423821yen.14 for ; Wed, 07 Dec 2011 19:25:02 -0800 (PST) Date: Wed, 7 Dec 2011 19:24:59 -0800 (PST) From: David Rientjes Subject: Re: [PATCH] mremap: enforce rmap src/dst vma ordering in case of vma_merge succeeding in copy_vma In-Reply-To: <1320512782-12209-1-git-send-email-aarcange@redhat.com> Message-ID: References: <1320512782-12209-1-git-send-email-aarcange@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org List-ID: To: Andrea Arcangeli Cc: Hugh Dickins , Mel Gorman , Pawel Sikora , Andrew Morton , linux-mm@kvack.org, jpiszcz@lucidpixels.com, arekm@pld-linux.org, linux-kernel@vger.kernel.org On Sat, 5 Nov 2011, Andrea Arcangeli wrote: > migrate was doing a rmap_walk with speculative lock-less access on > pagetables. That could lead it to not serialize properly against > mremap PT locks. But a second problem remains in the order of vmas in > the same_anon_vma list used by the rmap_walk. > > If vma_merge would succeed in copy_vma, the src vma could be placed > after the dst vma in the same_anon_vma list. That could still lead > migrate to miss some pte. > > This patch adds a anon_vma_moveto_tail() function to force the dst vma > at the end of the list before mremap starts to solve the problem. > > If the mremap is very large and there are a lots of parents or childs > sharing the anon_vma root lock, this should still scale better than > taking the anon_vma root lock around every pte copy practically for > the whole duration of mremap. > > Update: Hugh noticed special care is needed in the error path where > move_page_tables goes in the reverse direction, a second > anon_vma_moveto_tail() call is needed in the error path. > Is this still needed? It's missing in linux-next. -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org