From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZgDq-0001Pt-Ng for qemu-devel@nongnu.org; Tue, 07 May 2013 07:38:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZgDp-0008W9-C1 for qemu-devel@nongnu.org; Tue, 07 May 2013 07:38:18 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36715) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZgDp-0008W1-4B for qemu-devel@nongnu.org; Tue, 07 May 2013 07:38:17 -0400 Date: Tue, 7 May 2013 13:38:10 +0200 From: Andrew Jones Message-ID: <20130507113809.GB10720@hawk.usersys.redhat.com> References: <1367870221-12676-1-git-send-email-aarcange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1367870221-12676-1-git-send-email-aarcange@redhat.com> Subject: Re: [Qemu-devel] [PATCH 0/4] madvise(MADV_USERFAULT) & sys_remap_anon_pages() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andrea Arcangeli Cc: Anthony Liguori , Juan Quintela , Hugh Dickins , qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, Orit Wasserman , Mel Gorman , Paolo Bonzini , Isaku Yamahata On Mon, May 06, 2013 at 09:56:57PM +0200, Andrea Arcangeli wrote: > > The current behavior of remap_anon_pages is very strict to avoid any > chance of memory corruption going unnoticed, and it will return > -EFAULT at the first sign of something unexpected (like a page already > mapped in the destination pmd/pte, potentially signaling an userland > thread race condition with two threads userfaulting on the same > destination address). mremap is not strict like that: it would drop > the destination range silently and it would succeed in such a > condition. So on the API side, I wonder if I should add a flag to > remap_anon_pages to provide non-strict behavior more similar to > mremap. OTOH not providing the permissive mremap behavior may actually > be better to force userland to be strict and be sure it knows what it > is doing (otherwise it should use mremap in the first place?). > What about instead of adding a new syscall (remap_anon_pages) to instead extend mremap with new flags giving it a strict mode? drew