From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail138.messagelabs.com (mail138.messagelabs.com [216.82.249.35]) by kanga.kvack.org (Postfix) with ESMTP id 0E9E86B0047 for ; Mon, 16 Mar 2009 12:37:41 -0400 (EDT) Date: Mon, 16 Mar 2009 09:32:11 -0700 (PDT) From: Linus Torvalds Subject: Re: [aarcange@redhat.com: [PATCH] fork vs gup(-fast) fix] In-Reply-To: <200903170323.45917.nickpiggin@yahoo.com.au> Message-ID: References: <1237007189.25062.91.camel@pasglop> <200903141620.45052.nickpiggin@yahoo.com.au> <20090316223612.4B2A.A69D9226@jp.fujitsu.com> <200903170323.45917.nickpiggin@yahoo.com.au> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org To: Nick Piggin Cc: KOSAKI Motohiro , Benjamin Herrenschmidt , Andrea Arcangeli , Ingo Molnar , Nick Piggin , Hugh Dickins , KAMEZAWA Hiroyuki , linux-mm@kvack.org List-ID: On Tue, 17 Mar 2009, Nick Piggin wrote: > > Yes, my patch isn't realy solusion. > > Andrea already pointed out that it's not O_DIRECT issue, it's gup vs fork > > issue. *and* my patch is crazy slow :) > > Well, it's an interesting question. I'd say it probably is more than > just O_DIRECT. vmsplice too, for example (which I think is much harder > to fix this way because the pages are retired by the other end of > the pipe, so I don't think you can hold a lock across it). Well, only the "fork()" has the race problem. So having a fork-specific lock (but not naming it by directio) actually does make sense. The fork is much less performance-critical than most random mmap_sem users - and doesn't have the same scalability issues either (ie people probably _do_ want to do mmap/munmap/brk concurrently with gup lookup, but there's much less worry about concurrent fork() performance). It doesn't necessarily make the general problem go away, but it makes the _particular_ race between get_user_pages() and fork() go away. Then you can do per-page flags or whatever and not have to worry about concurrent lookups. Linus -- 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/ . Don't email: email@kvack.org