From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: handle_mm_fault() calling convention cleanup.. Date: Sun, 21 Jun 2009 13:42:35 -0700 (PDT) Message-ID: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Return-path: Sender: owner-linux-mm@kvack.org To: linux-arch@vger.kernel.org Cc: Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-Id: linux-arch.vger.kernel.org Just a heads up that I committed the patches that I sent out two months ago to make the fault handling routines use the finer-grained fault flags (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write". That was originally for the NOPAGE_RETRY patches, but it's a general cleanup too. I have this suspicion that we should extend this to "get_user_pages()" too, instead of having those boolean "write" and "force" flags (and GUP_FLAGS_xyzzy as opposed to FAULT_FLAGS_yyzzy). We should probably also get rid of the insane FOLL_xyz flags too. Right now the code in fact depends on FOLL_WRITE being the same as FAULT_FLAGS_WRITE, and while that is a simple dependency, it's just crazy how we have all these different flags for what ends up often boiling down to the same fundamental issue in the end (even if not all versions of the flags are necessarily always valid for all uses). I fixed up all architectures that I noticed (at least microblaze had been added since the original patches in April), but arch maintainers should double-check. Arch maintainers might also want to check whether the mindless conversion of 'is_write' => 'is_write ? FAULT_FLAGS_WRITE : 0' might perhaps be written in some more natural way (for example, maybe you'd like to get rid of 'iswrite' as a variable entirely, and replace it with a 'fault_flags' variable). It's pushed out and tested on x86-64, but it really was such a mindless conversion that I hope it works on all architectures. But I thought I'd better give people a shout-out regardless. 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Sun, 21 Jun 2009 19:20:01 -0700 (PDT) Message-ID: <20090621.192001.46889618.davem@davemloft.net> References: Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: owner-linux-mm@kvack.org To: torvalds@linux-foundation.org Cc: linux-arch@vger.kernel.org, hugh@veritas.com, npiggin@suse.de, akpm@linux-foundation.org, linux-mm@kvack.org, fengguang.wu@intel.com, mingo@elte.hu List-Id: linux-arch.vger.kernel.org From: Linus Torvalds Date: Sun, 21 Jun 2009 13:42:35 -0700 (PDT) > I fixed up all architectures that I noticed (at least microblaze had been > added since the original patches in April), but arch maintainers should > double-check. Arch maintainers might also want to check whether the > mindless conversion of > > 'is_write' => 'is_write ? FAULT_FLAGS_WRITE : 0' > > might perhaps be written in some more natural way (for example, maybe > you'd like to get rid of 'iswrite' as a variable entirely, and replace it > with a 'fault_flags' variable). > > It's pushed out and tested on x86-64, but it really was such a mindless > conversion that I hope it works on all architectures. But I thought I'd > better give people a shout-out regardless. Sparc looks good, and sparc64 seems to work fine. -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Mon, 22 Jun 2009 10:10:45 +0200 Message-ID: <20090622081045.GB11041@elte.hu> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang List-Id: linux-arch.vger.kernel.org * Linus Torvalds wrote: > Just a heads up that I committed the patches that I sent out two > months ago to make the fault handling routines use the > finer-grained fault flags (FAULT_FLAG_xyzzy) rather than passing > in a boolean for "write". All is fine on x86. Ingo -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Schwidefsky Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Mon, 22 Jun 2009 11:26:09 +0200 Message-ID: <20090622112609.118f53ae@skybase> References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from mtagate4.de.ibm.com ([195.212.29.153]:36281 "EHLO mtagate4.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753541AbZFVJ0U (ORCPT ); Mon, 22 Jun 2009 05:26:20 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate4.de.ibm.com (8.14.3/8.13.8) with ESMTP id n5M9QC9P229976 for ; Mon, 22 Jun 2009 09:26:12 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n5M9QBb32887820 for ; Mon, 22 Jun 2009 11:26:12 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n5M9QApY018180 for ; Mon, 22 Jun 2009 11:26:11 +0200 In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar On Sun, 21 Jun 2009 13:42:35 -0700 (PDT) Linus Torvalds wrote: > Just a heads up that I committed the patches that I sent out two months > ago to make the fault handling routines use the finer-grained fault flags > (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write". Todays git tree still works on s390. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Howells Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Mon, 22 Jun 2009 15:22:01 +0100 Message-ID: <3241.1245680521@redhat.com> References: Return-path: In-Reply-To: Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: dhowells@redhat.com, linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-Id: linux-arch.vger.kernel.org Linus Torvalds wrote: > It's pushed out and tested on x86-64, but it really was such a mindless > conversion that I hope it works on all architectures. But I thought I'd > better give people a shout-out regardless. Works on FRV and MN10300. David -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: James Bottomley Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Mon, 22 Jun 2009 09:58:01 -0500 Message-ID: <1245682681.6901.2.camel@mulgrave.site> References: Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-Id: linux-arch.vger.kernel.org On Sun, 2009-06-21 at 13:42 -0700, Linus Torvalds wrote: > I hope it works on all architectures. But I thought I'd > better give people a shout-out regardless. Works on parisc. James -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell King Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Mon, 22 Jun 2009 16:49:41 +0100 Message-ID: <20090622154941.GA3349@flint.arm.linux.org.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from caramon.arm.linux.org.uk ([78.32.30.218]:33399 "EHLO caramon.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753783AbZFVPu0 (ORCPT ); Mon, 22 Jun 2009 11:50:26 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar On Sun, Jun 21, 2009 at 01:42:35PM -0700, Linus Torvalds wrote: > It's pushed out and tested on x86-64, but it really was such a mindless > conversion that I hope it works on all architectures. But I thought I'd > better give people a shout-out regardless. Works fine on ARM, thanks. -- Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Tue, 23 Jun 2009 09:18:48 +0200 Message-ID: <20090623071848.GC21180@wotan.suse.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-Id: linux-arch.vger.kernel.org On Sun, Jun 21, 2009 at 01:42:35PM -0700, Linus Torvalds wrote: > > Just a heads up that I committed the patches that I sent out two months > ago to make the fault handling routines use the finer-grained fault flags > (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write". While you've got everyone's attention, may I just remind arch maintainers to consider using pagefault_out_of_memory() rather than unconditional kill current in the pagefault OOM case. See x86. Thanks, Nick -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Sat, 04 Jul 2009 09:35:07 +1000 Message-ID: <1246664107.7551.11.camel@pasglop> References: Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-Id: linux-arch.vger.kernel.org On Sun, 2009-06-21 at 13:42 -0700, Linus Torvalds wrote: > Just a heads up that I committed the patches that I sent out two months > ago to make the fault handling routines use the finer-grained fault flags > (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write". > > That was originally for the NOPAGE_RETRY patches, but it's a general > cleanup too. I have this suspicion that we should extend this to > "get_user_pages()" too, instead of having those boolean "write" and > "force" flags (and GUP_FLAGS_xyzzy as opposed to FAULT_FLAGS_yyzzy). BTW. I'd like to extend these if there's no objection one of these days to also pass whether it was an exec fault, and pass the full flags to ptep_set_access_flags(). That would (finally) give us a better hook for architectures that need to do it to handle i$/d$ coherency. Right now, I go dig for the current fault type inside the current pt_regs from ptep_set_access_flags() which is positively ugly. Ben. > We should probably also get rid of the insane FOLL_xyz flags too. Right > now the code in fact depends on FOLL_WRITE being the same as > FAULT_FLAGS_WRITE, and while that is a simple dependency, it's just crazy > how we have all these different flags for what ends up often boiling down > to the same fundamental issue in the end (even if not all versions of the > flags are necessarily always valid for all uses). > > I fixed up all architectures that I noticed (at least microblaze had been > added since the original patches in April), but arch maintainers should > double-check. Arch maintainers might also want to check whether the > mindless conversion of > > 'is_write' => 'is_write ? FAULT_FLAGS_WRITE : 0' > > might perhaps be written in some more natural way (for example, maybe > you'd like to get rid of 'iswrite' as a variable entirely, and replace it > with a 'fault_flags' variable). > > It's pushed out and tested on x86-64, but it really was such a mindless > conversion that I hope it works on all architectures. But I thought I'd > better give people a shout-out regardless. > > 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 -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Sat, 4 Jul 2009 09:44:38 -0700 (PDT) Message-ID: References: <1246664107.7551.11.camel@pasglop> Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Return-path: In-Reply-To: <1246664107.7551.11.camel@pasglop> Sender: owner-linux-mm@kvack.org To: Benjamin Herrenschmidt Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-Id: linux-arch.vger.kernel.org On Sat, 4 Jul 2009, Benjamin Herrenschmidt wrote: > > BTW. I'd like to extend these if there's no objection one of these days > to also pass whether it was an exec fault, and pass the full flags to > ptep_set_access_flags(). Sure. No problem, and sounds sane. Just a tiny word of warning: right now, the conversion I did pretty much depended on the fact that even if I missed a spot, it wouldn't actually make any difference. If somebody used "flags" as a binary value (ie like the old "write_access" kind of semantics), things would still all work, because it was still a "zero-vs-nonzero" issue wrt writes. And there were cases in the hugepage handling that I had missed, that Hugh picked up. Maybe he picked them all - but be careful. I didn't add any flags (like the FAULT_FLAG_RETRY thing that started it all) that would actually _require_ everybody to always treat it as a bitmask. And some places still pass the flags down as basically just the "write or not" thing. ptep_set_access_flags() stands out as one of them (and I think your suggestion would actually clean things up), but there are probably others. 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Sun, 05 Jul 2009 07:08:38 +1000 Message-ID: <1246741718.7551.22.camel@pasglop> References: <1246664107.7551.11.camel@pasglop> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-Id: linux-arch.vger.kernel.org On Sat, 2009-07-04 at 09:44 -0700, Linus Torvalds wrote: > Just a tiny word of warning: right now, the conversion I did pretty much > depended on the fact that even if I missed a spot, it wouldn't actually > make any difference. If somebody used "flags" as a binary value (ie like > the old "write_access" kind of semantics), things would still all work, > because it was still a "zero-vs-nonzero" issue wrt writes. .../... Right. Oh well.. we'll see when I get to it. I have a few higher priority things on my pile at the moment. Cheers, Ben. -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Mon, 6 Jul 2009 09:31:48 +0200 Message-ID: <20090706073148.GJ2714@wotan.suse.de> References: <1246664107.7551.11.camel@pasglop> <1246741718.7551.22.camel@pasglop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from cantor2.suse.de ([195.135.220.15]:57361 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750824AbZGFHbr (ORCPT ); Mon, 6 Jul 2009 03:31:47 -0400 Content-Disposition: inline In-Reply-To: <1246741718.7551.22.camel@pasglop> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Benjamin Herrenschmidt Cc: Linus Torvalds , linux-arch@vger.kernel.org, Hugh Dickins , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar On Sun, Jul 05, 2009 at 07:08:38AM +1000, Benjamin Herrenschmidt wrote: > On Sat, 2009-07-04 at 09:44 -0700, Linus Torvalds wrote: > > > Just a tiny word of warning: right now, the conversion I did pretty much > > depended on the fact that even if I missed a spot, it wouldn't actually > > make any difference. If somebody used "flags" as a binary value (ie like > > the old "write_access" kind of semantics), things would still all work, > > because it was still a "zero-vs-nonzero" issue wrt writes. > > .../... > > Right. Oh well.. we'll see when I get to it. I have a few higher > priority things on my pile at the moment. I have no problems with that. I'd always intended to have flags go further up the call chain like Linus did (since we'd discussed perhaps making faults interruptible and requiring an extra flag to distinguish get_user_pages callers that were not interruptible). So yes adding more flags to improve code or make things simpler is fine by me :) Thanks, Nick From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Herrenschmidt Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Mon, 06 Jul 2009 20:56:16 +1000 Message-ID: <1246877776.22625.39.camel@pasglop> References: <1246664107.7551.11.camel@pasglop> <1246741718.7551.22.camel@pasglop> <20090706073148.GJ2714@wotan.suse.de> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20090706073148.GJ2714@wotan.suse.de> Sender: owner-linux-mm@kvack.org To: Nick Piggin Cc: Linus Torvalds , linux-arch@vger.kernel.org, Hugh Dickins , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-Id: linux-arch.vger.kernel.org On Mon, 2009-07-06 at 09:31 +0200, Nick Piggin wrote: > I have no problems with that. I'd always intended to have flags > go further up the call chain like Linus did (since we'd discussed > perhaps making faults interruptible and requiring an extra flag > to distinguish get_user_pages callers that were not interruptible). > > So yes adding more flags to improve code or make things simpler > is fine by me :) > That's before you see my evil plan of bringing the flags all the way down to set_pte_at() :-) Cheers, Ben. -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Piggin Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Mon, 6 Jul 2009 13:53:58 +0200 Message-ID: <20090706115358.GO2714@wotan.suse.de> References: <1246664107.7551.11.camel@pasglop> <1246741718.7551.22.camel@pasglop> <20090706073148.GJ2714@wotan.suse.de> <1246877776.22625.39.camel@pasglop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1246877776.22625.39.camel@pasglop> Sender: owner-linux-mm@kvack.org To: Benjamin Herrenschmidt Cc: Linus Torvalds , linux-arch@vger.kernel.org, Hugh Dickins , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-Id: linux-arch.vger.kernel.org On Mon, Jul 06, 2009 at 08:56:16PM +1000, Benjamin Herrenschmidt wrote: > On Mon, 2009-07-06 at 09:31 +0200, Nick Piggin wrote: > > I have no problems with that. I'd always intended to have flags > > go further up the call chain like Linus did (since we'd discussed > > perhaps making faults interruptible and requiring an extra flag > > to distinguish get_user_pages callers that were not interruptible). > > > > So yes adding more flags to improve code or make things simpler > > is fine by me :) > > > That's before you see my evil plan of bringing the flags all the way > down to set_pte_at() :-) So long as it can be nooped out of x86 I don't see it being a problem. One problem x86 has with the mm/memory.c code is that it runs out of registers (especially in fork/exit iirc). So I wouldn't like to add unnecessary arguments to functions if they cannot be optimised away. -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:41772 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752665AbZFUUmt (ORCPT ); Sun, 21 Jun 2009 16:42:49 -0400 Date: Sun, 21 Jun 2009 13:42:35 -0700 (PDT) From: Linus Torvalds Subject: handle_mm_fault() calling convention cleanup.. Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-arch-owner@vger.kernel.org List-ID: To: linux-arch@vger.kernel.org Cc: Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar Message-ID: <20090621204235.dD7YBZMipYF-iOrHkP3iUGBXSuEO3TXcAWwTlmQc7og@z> Just a heads up that I committed the patches that I sent out two months ago to make the fault handling routines use the finer-grained fault flags (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write". That was originally for the NOPAGE_RETRY patches, but it's a general cleanup too. I have this suspicion that we should extend this to "get_user_pages()" too, instead of having those boolean "write" and "force" flags (and GUP_FLAGS_xyzzy as opposed to FAULT_FLAGS_yyzzy). We should probably also get rid of the insane FOLL_xyz flags too. Right now the code in fact depends on FOLL_WRITE being the same as FAULT_FLAGS_WRITE, and while that is a simple dependency, it's just crazy how we have all these different flags for what ends up often boiling down to the same fundamental issue in the end (even if not all versions of the flags are necessarily always valid for all uses). I fixed up all architectures that I noticed (at least microblaze had been added since the original patches in April), but arch maintainers should double-check. Arch maintainers might also want to check whether the mindless conversion of 'is_write' => 'is_write ? FAULT_FLAGS_WRITE : 0' might perhaps be written in some more natural way (for example, maybe you'd like to get rid of 'iswrite' as a variable entirely, and replace it with a 'fault_flags' variable). It's pushed out and tested on x86-64, but it really was such a mindless conversion that I hope it works on all architectures. But I thought I'd better give people a shout-out regardless. Linus From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from 74-93-104-97-Washington.hfc.comcastbusiness.net ([74.93.104.97]:52786 "EHLO sunset.davemloft.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752286AbZFVCT5 (ORCPT ); Sun, 21 Jun 2009 22:19:57 -0400 Date: Sun, 21 Jun 2009 19:20:01 -0700 (PDT) Message-ID: <20090621.192001.46889618.davem@davemloft.net> Subject: Re: handle_mm_fault() calling convention cleanup.. From: David Miller In-Reply-To: References: Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: torvalds@linux-foundation.org Cc: linux-arch@vger.kernel.org, hugh@veritas.com, npiggin@suse.de, akpm@linux-foundation.org, linux-mm@kvack.org, fengguang.wu@intel.com, mingo@elte.hu Message-ID: <20090622022001.p5NYWBlBTfJQf59uveYWrFvdvZhO1YjncpoW0eXShZ0@z> From: Linus Torvalds Date: Sun, 21 Jun 2009 13:42:35 -0700 (PDT) > I fixed up all architectures that I noticed (at least microblaze had been > added since the original patches in April), but arch maintainers should > double-check. Arch maintainers might also want to check whether the > mindless conversion of > > 'is_write' => 'is_write ? FAULT_FLAGS_WRITE : 0' > > might perhaps be written in some more natural way (for example, maybe > you'd like to get rid of 'iswrite' as a variable entirely, and replace it > with a 'fault_flags' variable). > > It's pushed out and tested on x86-64, but it really was such a mindless > conversion that I hope it works on all architectures. But I thought I'd > better give people a shout-out regardless. Sparc looks good, and sparc64 seems to work fine. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3.mail.elte.hu ([157.181.1.138]:51377 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751169AbZFVIK6 (ORCPT ); Mon, 22 Jun 2009 04:10:58 -0400 Date: Mon, 22 Jun 2009 10:10:45 +0200 From: Ingo Molnar Subject: Re: handle_mm_fault() calling convention cleanup.. Message-ID: <20090622081045.GB11041@elte.hu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang Message-ID: <20090622081045.E5s8xRMhxQi12jGDADjhAGfu6VQH8B_eBK6CIZAXZ_Q@z> * Linus Torvalds wrote: > Just a heads up that I committed the patches that I sent out two > months ago to make the fault handling routines use the > finer-grained fault flags (FAULT_FLAG_xyzzy) rather than passing > in a boolean for "write". All is fine on x86. Ingo From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.redhat.com ([66.187.237.31]:53332 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750731AbZFVOWT (ORCPT ); Mon, 22 Jun 2009 10:22:19 -0400 From: David Howells In-Reply-To: References: Subject: Re: handle_mm_fault() calling convention cleanup.. Date: Mon, 22 Jun 2009 15:22:01 +0100 Message-ID: <3241.1245680521@redhat.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: dhowells@redhat.com, linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar Message-ID: <20090622142201.44Q_9mhlcqTygS2S637zlfSbqpA3YVt0jfElvG0_Jv0@z> Linus Torvalds wrote: > It's pushed out and tested on x86-64, but it really was such a mindless > conversion that I hope it works on all architectures. But I thought I'd > better give people a shout-out regardless. Works on FRV and MN10300. David From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bedivere.hansenpartnership.com ([66.63.167.143]:46787 "EHLO bedivere.hansenpartnership.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751497AbZFVO6F (ORCPT ); Mon, 22 Jun 2009 10:58:05 -0400 Subject: Re: handle_mm_fault() calling convention cleanup.. From: James Bottomley In-Reply-To: References: Content-Type: text/plain Date: Mon, 22 Jun 2009 09:58:01 -0500 Message-ID: <1245682681.6901.2.camel@mulgrave.site> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar Message-ID: <20090622145801.tWWYVtxd340yQ4XcWAgRVJqiUaFv5Hy3NNEE2yRehTQ@z> On Sun, 2009-06-21 at 13:42 -0700, Linus Torvalds wrote: > I hope it works on all architectures. But I thought I'd > better give people a shout-out regardless. Works on parisc. James From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cantor.suse.de ([195.135.220.2]:33181 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752995AbZFWHSr (ORCPT ); Tue, 23 Jun 2009 03:18:47 -0400 Date: Tue, 23 Jun 2009 09:18:48 +0200 From: Nick Piggin Subject: Re: handle_mm_fault() calling convention cleanup.. Message-ID: <20090623071848.GC21180@wotan.suse.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar Message-ID: <20090623071848.fLK8a4KDzlDB-D7ClRKH_uu3w5NDWg74LcDcNuk2ap0@z> On Sun, Jun 21, 2009 at 01:42:35PM -0700, Linus Torvalds wrote: > > Just a heads up that I committed the patches that I sent out two months > ago to make the fault handling routines use the finer-grained fault flags > (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write". While you've got everyone's attention, may I just remind arch maintainers to consider using pagefault_out_of_memory() rather than unconditional kill current in the pagefault OOM case. See x86. Thanks, Nick From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org ([63.228.1.57]:45267 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751312AbZGCXfo (ORCPT ); Fri, 3 Jul 2009 19:35:44 -0400 Subject: Re: handle_mm_fault() calling convention cleanup.. From: Benjamin Herrenschmidt In-Reply-To: References: Content-Type: text/plain Date: Sat, 04 Jul 2009 09:35:07 +1000 Message-ID: <1246664107.7551.11.camel@pasglop> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar Message-ID: <20090703233507.Rs8Dfmpca1qfpFzyZo9VusFME8CkdEbXptS-DdVDCN0@z> On Sun, 2009-06-21 at 13:42 -0700, Linus Torvalds wrote: > Just a heads up that I committed the patches that I sent out two months > ago to make the fault handling routines use the finer-grained fault flags > (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write". > > That was originally for the NOPAGE_RETRY patches, but it's a general > cleanup too. I have this suspicion that we should extend this to > "get_user_pages()" too, instead of having those boolean "write" and > "force" flags (and GUP_FLAGS_xyzzy as opposed to FAULT_FLAGS_yyzzy). BTW. I'd like to extend these if there's no objection one of these days to also pass whether it was an exec fault, and pass the full flags to ptep_set_access_flags(). That would (finally) give us a better hook for architectures that need to do it to handle i$/d$ coherency. Right now, I go dig for the current fault type inside the current pt_regs from ptep_set_access_flags() which is positively ugly. Ben. > We should probably also get rid of the insane FOLL_xyz flags too. Right > now the code in fact depends on FOLL_WRITE being the same as > FAULT_FLAGS_WRITE, and while that is a simple dependency, it's just crazy > how we have all these different flags for what ends up often boiling down > to the same fundamental issue in the end (even if not all versions of the > flags are necessarily always valid for all uses). > > I fixed up all architectures that I noticed (at least microblaze had been > added since the original patches in April), but arch maintainers should > double-check. Arch maintainers might also want to check whether the > mindless conversion of > > 'is_write' => 'is_write ? FAULT_FLAGS_WRITE : 0' > > might perhaps be written in some more natural way (for example, maybe > you'd like to get rid of 'iswrite' as a variable entirely, and replace it > with a 'fault_flags' variable). > > It's pushed out and tested on x86-64, but it really was such a mindless > conversion that I hope it works on all architectures. But I thought I'd > better give people a shout-out regardless. > > 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:55158 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750888AbZGDQpM (ORCPT ); Sat, 4 Jul 2009 12:45:12 -0400 Date: Sat, 4 Jul 2009 09:44:38 -0700 (PDT) From: Linus Torvalds Subject: Re: handle_mm_fault() calling convention cleanup.. In-Reply-To: <1246664107.7551.11.camel@pasglop> Message-ID: References: <1246664107.7551.11.camel@pasglop> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-arch-owner@vger.kernel.org List-ID: To: Benjamin Herrenschmidt Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar Message-ID: <20090704164438.id6znU4ErxXdK5y3jKBqjPDttXejTW59KQIUPdwgn-A@z> On Sat, 4 Jul 2009, Benjamin Herrenschmidt wrote: > > BTW. I'd like to extend these if there's no objection one of these days > to also pass whether it was an exec fault, and pass the full flags to > ptep_set_access_flags(). Sure. No problem, and sounds sane. Just a tiny word of warning: right now, the conversion I did pretty much depended on the fact that even if I missed a spot, it wouldn't actually make any difference. If somebody used "flags" as a binary value (ie like the old "write_access" kind of semantics), things would still all work, because it was still a "zero-vs-nonzero" issue wrt writes. And there were cases in the hugepage handling that I had missed, that Hugh picked up. Maybe he picked them all - but be careful. I didn't add any flags (like the FAULT_FLAG_RETRY thing that started it all) that would actually _require_ everybody to always treat it as a bitmask. And some places still pass the flags down as basically just the "write or not" thing. ptep_set_access_flags() stands out as one of them (and I think your suggestion would actually clean things up), but there are probably others. Linus From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org ([63.228.1.57]:36717 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751438AbZGDVLe (ORCPT ); Sat, 4 Jul 2009 17:11:34 -0400 Subject: Re: handle_mm_fault() calling convention cleanup.. From: Benjamin Herrenschmidt In-Reply-To: References: <1246664107.7551.11.camel@pasglop> Content-Type: text/plain Date: Sun, 05 Jul 2009 07:08:38 +1000 Message-ID: <1246741718.7551.22.camel@pasglop> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar Message-ID: <20090704210838.JAo5geU3LeKnOBq0S8UC8OAzSNXuFIJxYf0AWUn8Nv4@z> On Sat, 2009-07-04 at 09:44 -0700, Linus Torvalds wrote: > Just a tiny word of warning: right now, the conversion I did pretty much > depended on the fact that even if I missed a spot, it wouldn't actually > make any difference. If somebody used "flags" as a binary value (ie like > the old "write_access" kind of semantics), things would still all work, > because it was still a "zero-vs-nonzero" issue wrt writes. .../... Right. Oh well.. we'll see when I get to it. I have a few higher priority things on my pile at the moment. Cheers, Ben. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate.crashing.org ([63.228.1.57]:50126 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753732AbZGFK4n (ORCPT ); Mon, 6 Jul 2009 06:56:43 -0400 Subject: Re: handle_mm_fault() calling convention cleanup.. From: Benjamin Herrenschmidt In-Reply-To: <20090706073148.GJ2714@wotan.suse.de> References: <1246664107.7551.11.camel@pasglop> <1246741718.7551.22.camel@pasglop> <20090706073148.GJ2714@wotan.suse.de> Content-Type: text/plain Date: Mon, 06 Jul 2009 20:56:16 +1000 Message-ID: <1246877776.22625.39.camel@pasglop> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-arch-owner@vger.kernel.org List-ID: To: Nick Piggin Cc: Linus Torvalds , linux-arch@vger.kernel.org, Hugh Dickins , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar Message-ID: <20090706105616.Bgl0B2l0QZvNb8Md_2DfY1IeHyoAGjoP-SO-e_zES60@z> On Mon, 2009-07-06 at 09:31 +0200, Nick Piggin wrote: > I have no problems with that. I'd always intended to have flags > go further up the call chain like Linus did (since we'd discussed > perhaps making faults interruptible and requiring an extra flag > to distinguish get_user_pages callers that were not interruptible). > > So yes adding more flags to improve code or make things simpler > is fine by me :) > That's before you see my evil plan of bringing the flags all the way down to set_pte_at() :-) Cheers, Ben. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cantor2.suse.de ([195.135.220.15]:35797 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752343AbZGFLx4 (ORCPT ); Mon, 6 Jul 2009 07:53:56 -0400 Date: Mon, 6 Jul 2009 13:53:58 +0200 From: Nick Piggin Subject: Re: handle_mm_fault() calling convention cleanup.. Message-ID: <20090706115358.GO2714@wotan.suse.de> References: <1246664107.7551.11.camel@pasglop> <1246741718.7551.22.camel@pasglop> <20090706073148.GJ2714@wotan.suse.de> <1246877776.22625.39.camel@pasglop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1246877776.22625.39.camel@pasglop> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Benjamin Herrenschmidt Cc: Linus Torvalds , linux-arch@vger.kernel.org, Hugh Dickins , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar Message-ID: <20090706115358.5qwGilO86PkzRjmd36dVtcetetnLFDWKGoWKij6wsd4@z> On Mon, Jul 06, 2009 at 08:56:16PM +1000, Benjamin Herrenschmidt wrote: > On Mon, 2009-07-06 at 09:31 +0200, Nick Piggin wrote: > > I have no problems with that. I'd always intended to have flags > > go further up the call chain like Linus did (since we'd discussed > > perhaps making faults interruptible and requiring an extra flag > > to distinguish get_user_pages callers that were not interruptible). > > > > So yes adding more flags to improve code or make things simpler > > is fine by me :) > > > That's before you see my evil plan of bringing the flags all the way > down to set_pte_at() :-) So long as it can be nooped out of x86 I don't see it being a problem. One problem x86 has with the mm/memory.c code is that it runs out of registers (especially in fork/exit iirc). So I wouldn't like to add unnecessary arguments to functions if they cannot be optimised away. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail143.messagelabs.com (mail143.messagelabs.com [216.82.254.35]) by kanga.kvack.org (Postfix) with ESMTP id 7FA816B004F for ; Mon, 22 Jun 2009 05:26:30 -0400 (EDT) Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate5.de.ibm.com (8.14.3/8.13.8) with ESMTP id n5M9QBX9557430 for ; Mon, 22 Jun 2009 09:26:11 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n5M9QBEg2937032 for ; Mon, 22 Jun 2009 11:26:11 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n5M9QApQ018180 for ; Mon, 22 Jun 2009 11:26:11 +0200 Date: Mon, 22 Jun 2009 11:26:09 +0200 From: Martin Schwidefsky Subject: Re: handle_mm_fault() calling convention cleanup.. Message-ID: <20090622112609.118f53ae@skybase> In-Reply-To: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-ID: On Sun, 21 Jun 2009 13:42:35 -0700 (PDT) Linus Torvalds wrote: > Just a heads up that I committed the patches that I sent out two months > ago to make the fault handling routines use the finer-grained fault flags > (FAULT_FLAG_xyzzy) rather than passing in a boolean for "write". Todays git tree still works on s390. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin. -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail202.messagelabs.com (mail202.messagelabs.com [216.82.254.227]) by kanga.kvack.org (Postfix) with ESMTP id 43D496B004D for ; Mon, 22 Jun 2009 11:52:41 -0400 (EDT) Date: Mon, 22 Jun 2009 16:49:41 +0100 From: Russell King Subject: Re: handle_mm_fault() calling convention cleanup.. Message-ID: <20090622154941.GA3349@flint.arm.linux.org.uk> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: linux-arch@vger.kernel.org, Hugh Dickins , Nick Piggin , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-ID: On Sun, Jun 21, 2009 at 01:42:35PM -0700, Linus Torvalds wrote: > It's pushed out and tested on x86-64, but it really was such a mindless > conversion that I hope it works on all architectures. But I thought I'd > better give people a shout-out regardless. Works fine on ARM, thanks. -- Russell King Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/ maintainer of: -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail191.messagelabs.com (mail191.messagelabs.com [216.82.242.19]) by kanga.kvack.org (Postfix) with SMTP id D5A306B004F for ; Tue, 23 Jun 2009 08:47:44 -0400 (EDT) Date: Tue, 23 Jun 2009 13:49:05 +0100 (BST) From: Hugh Dickins Subject: [PATCH] hugetlb: fault flags instead of write_access In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: Nick Piggin , Andrew Morton , Mel Gorman , Wu Fengguang , Ingo Molnar , linux-mm@kvack.org List-ID: handle_mm_fault() is now passing fault flags rather than write_access down to hugetlb_fault(), so better recognize that in hugetlb_fault(), and in hugetlb_no_page(). Signed-off-by: Hugh Dickins --- include/linux/hugetlb.h | 4 ++-- mm/hugetlb.c | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) --- 2.6.30-git20/include/linux/hugetlb.h 2009-06-23 11:06:22.000000000 +0100 +++ linux/include/linux/hugetlb.h 2009-06-23 13:07:57.000000000 +0100 @@ -33,7 +33,7 @@ void hugetlb_report_meminfo(struct seq_f int hugetlb_report_node_meminfo(int, char *); unsigned long hugetlb_total_pages(void); int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, - unsigned long address, int write_access); + unsigned long address, unsigned int flags); int hugetlb_reserve_pages(struct inode *inode, long from, long to, struct vm_area_struct *vma, int acctflags); @@ -98,7 +98,7 @@ static inline void hugetlb_report_meminf #define pud_huge(x) 0 #define is_hugepage_only_range(mm, addr, len) 0 #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) -#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) +#define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; }) #define hugetlb_change_protection(vma, address, end, newprot) --- 2.6.30-git20/mm/hugetlb.c 2009-06-23 11:06:25.000000000 +0100 +++ linux/mm/hugetlb.c 2009-06-23 13:07:57.000000000 +0100 @@ -1985,7 +1985,7 @@ static struct page *hugetlbfs_pagecache_ } static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma, - unsigned long address, pte_t *ptep, int write_access) + unsigned long address, pte_t *ptep, unsigned int flags) { struct hstate *h = hstate_vma(vma); int ret = VM_FAULT_SIGBUS; @@ -2053,7 +2053,7 @@ retry: * any allocations necessary to record that reservation occur outside * the spinlock. */ - if (write_access && !(vma->vm_flags & VM_SHARED)) + if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) if (vma_needs_reservation(h, vma, address) < 0) { ret = VM_FAULT_OOM; goto backout_unlocked; @@ -2072,7 +2072,7 @@ retry: && (vma->vm_flags & VM_SHARED))); set_huge_pte_at(mm, address, ptep, new_pte); - if (write_access && !(vma->vm_flags & VM_SHARED)) { + if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) { /* Optimization, do the COW without a second fault */ ret = hugetlb_cow(mm, vma, address, ptep, new_pte, page); } @@ -2091,7 +2091,7 @@ backout_unlocked: } int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, - unsigned long address, int write_access) + unsigned long address, unsigned int flags) { pte_t *ptep; pte_t entry; @@ -2112,7 +2112,7 @@ int hugetlb_fault(struct mm_struct *mm, mutex_lock(&hugetlb_instantiation_mutex); entry = huge_ptep_get(ptep); if (huge_pte_none(entry)) { - ret = hugetlb_no_page(mm, vma, address, ptep, write_access); + ret = hugetlb_no_page(mm, vma, address, ptep, flags); goto out_mutex; } @@ -2126,7 +2126,7 @@ int hugetlb_fault(struct mm_struct *mm, * page now as it is used to determine if a reservation has been * consumed. */ - if (write_access && !pte_write(entry)) { + if ((flags & FAULT_FLAG_WRITE) && !pte_write(entry)) { if (vma_needs_reservation(h, vma, address) < 0) { ret = VM_FAULT_OOM; goto out_mutex; @@ -2143,7 +2143,7 @@ int hugetlb_fault(struct mm_struct *mm, goto out_page_table_lock; - if (write_access) { + if (flags & FAULT_FLAG_WRITE) { if (!pte_write(entry)) { ret = hugetlb_cow(mm, vma, address, ptep, entry, pagecache_page); @@ -2152,7 +2152,8 @@ int hugetlb_fault(struct mm_struct *mm, entry = pte_mkdirty(entry); } entry = pte_mkyoung(entry); - if (huge_ptep_set_access_flags(vma, address, ptep, entry, write_access)) + if (huge_ptep_set_access_flags(vma, address, ptep, entry, + flags & FAULT_FLAG_WRITE)) update_mmu_cache(vma, address, entry); out_page_table_lock: -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail137.messagelabs.com (mail137.messagelabs.com [216.82.249.19]) by kanga.kvack.org (Postfix) with SMTP id 6FD186B004F for ; Tue, 23 Jun 2009 08:51:17 -0400 (EDT) Date: Tue, 23 Jun 2009 13:52:49 +0100 (BST) From: Hugh Dickins Subject: [PATCH] mm: don't rely on flags coincidence In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org To: Linus Torvalds Cc: Nick Piggin , Andrew Morton , Mel Gorman , Wu Fengguang , Ingo Molnar , linux-mm@kvack.org List-ID: Indeed FOLL_WRITE matches FAULT_FLAG_WRITE, matches GUP_FLAGS_WRITE, and it's tempting to devise a set of Grand Unified Paging flags; but not today. So until then, let's rely upon the compiler to spot the coincidence, "rather than have that subtle dependency and a comment for it" - as you remarked in another context yesterday. Signed-off-by: Hugh Dickins --- mm/memory.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- 2.6.30-git20/mm/memory.c 2009-06-23 11:06:25.000000000 +0100 +++ linux/mm/memory.c 2009-06-23 13:07:57.000000000 +0100 @@ -1311,8 +1311,10 @@ int __get_user_pages(struct task_struct while (!(page = follow_page(vma, start, foll_flags))) { int ret; - /* FOLL_WRITE matches FAULT_FLAG_WRITE! */ - ret = handle_mm_fault(mm, vma, start, foll_flags & FOLL_WRITE); + ret = handle_mm_fault(mm, vma, start, + (foll_flags & FOLL_WRITE) ? + FAULT_FLAG_WRITE : 0); + if (ret & VM_FAULT_ERROR) { if (ret & VM_FAULT_OOM) return i ? i : -ENOMEM; -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail137.messagelabs.com (mail137.messagelabs.com [216.82.249.19]) by kanga.kvack.org (Postfix) with SMTP id 984E66B005D for ; Tue, 23 Jun 2009 08:55:13 -0400 (EDT) Date: Tue, 23 Jun 2009 20:56:44 +0800 From: Wu Fengguang Subject: Re: [PATCH] hugetlb: fault flags instead of write_access Message-ID: <20090623125644.GA18603@localhost> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org To: Hugh Dickins Cc: Linus Torvalds , Nick Piggin , Andrew Morton , Mel Gorman , Ingo Molnar , "linux-mm@kvack.org" List-ID: On Tue, Jun 23, 2009 at 08:49:05PM +0800, Hugh Dickins wrote: > handle_mm_fault() is now passing fault flags rather than write_access > down to hugetlb_fault(), so better recognize that in hugetlb_fault(), > and in hugetlb_no_page(). > > Signed-off-by: Hugh Dickins Looks OK and compiles OK. Thanks, Fengguang -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail202.messagelabs.com (mail202.messagelabs.com [216.82.254.227]) by kanga.kvack.org (Postfix) with SMTP id 50C0B6B0082 for ; Tue, 23 Jun 2009 09:01:17 -0400 (EDT) Date: Tue, 23 Jun 2009 21:00:58 +0800 From: Wu Fengguang Subject: Re: [PATCH] mm: don't rely on flags coincidence Message-ID: <20090623130058.GB18603@localhost> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org To: Hugh Dickins Cc: Linus Torvalds , Nick Piggin , Andrew Morton , Mel Gorman , Ingo Molnar , "linux-mm@kvack.org" List-ID: On Tue, Jun 23, 2009 at 08:52:49PM +0800, Hugh Dickins wrote: > Indeed FOLL_WRITE matches FAULT_FLAG_WRITE, matches GUP_FLAGS_WRITE, > and it's tempting to devise a set of Grand Unified Paging flags; > but not today. So until then, let's rely upon the compiler to spot > the coincidence, "rather than have that subtle dependency and a > comment for it" - as you remarked in another context yesterday. > > Signed-off-by: Hugh Dickins Acked-by: Wu Fengguang > --- > > mm/memory.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > --- 2.6.30-git20/mm/memory.c 2009-06-23 11:06:25.000000000 +0100 > +++ linux/mm/memory.c 2009-06-23 13:07:57.000000000 +0100 > @@ -1311,8 +1311,10 @@ int __get_user_pages(struct task_struct > while (!(page = follow_page(vma, start, foll_flags))) { > int ret; > > - /* FOLL_WRITE matches FAULT_FLAG_WRITE! */ > - ret = handle_mm_fault(mm, vma, start, foll_flags & FOLL_WRITE); > + ret = handle_mm_fault(mm, vma, start, > + (foll_flags & FOLL_WRITE) ? > + FAULT_FLAG_WRITE : 0); > + > if (ret & VM_FAULT_ERROR) { > if (ret & VM_FAULT_OOM) > return i ? i : -ENOMEM; -- 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 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 SMTP id 4DC586B0055 for ; Tue, 23 Jun 2009 17:35:56 -0400 (EDT) Message-ID: <4A414ADC.5080402@redhat.com> Date: Tue, 23 Jun 2009 17:36:28 -0400 From: Rik van Riel MIME-Version: 1.0 Subject: Re: [PATCH] hugetlb: fault flags instead of write_access References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org To: Hugh Dickins Cc: Linus Torvalds , Nick Piggin , Andrew Morton , Mel Gorman , Wu Fengguang , Ingo Molnar , linux-mm@kvack.org List-ID: Hugh Dickins wrote: > handle_mm_fault() is now passing fault flags rather than write_access > down to hugetlb_fault(), so better recognize that in hugetlb_fault(), > and in hugetlb_no_page(). > > Signed-off-by: Hugh Dickins Reviewed-by: Rik van Riel -- All rights reversed. -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail144.messagelabs.com (mail144.messagelabs.com [216.82.254.51]) by kanga.kvack.org (Postfix) with SMTP id CF7216B0055 for ; Tue, 23 Jun 2009 17:37:35 -0400 (EDT) Message-ID: <4A414B3E.9020000@redhat.com> Date: Tue, 23 Jun 2009 17:38:06 -0400 From: Rik van Riel MIME-Version: 1.0 Subject: Re: [PATCH] mm: don't rely on flags coincidence References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org To: Hugh Dickins Cc: Linus Torvalds , Nick Piggin , Andrew Morton , Mel Gorman , Wu Fengguang , Ingo Molnar , linux-mm@kvack.org List-ID: Hugh Dickins wrote: > Indeed FOLL_WRITE matches FAULT_FLAG_WRITE, matches GUP_FLAGS_WRITE, > and it's tempting to devise a set of Grand Unified Paging flags; > but not today. So until then, let's rely upon the compiler to spot > the coincidence, "rather than have that subtle dependency and a > comment for it" - as you remarked in another context yesterday. > > Signed-off-by: Hugh Dickins Good catch. Reviewed-by: Rik van Riel -- All rights reversed. -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail143.messagelabs.com (mail143.messagelabs.com [216.82.254.35]) by kanga.kvack.org (Postfix) with ESMTP id 6FBE36B005A for ; Mon, 29 Jun 2009 08:28:36 -0400 (EDT) Date: Mon, 29 Jun 2009 13:29:25 +0100 From: Mel Gorman Subject: Re: [PATCH] hugetlb: fault flags instead of write_access Message-ID: <20090629122925.GB5065@csn.ul.ie> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org To: Hugh Dickins Cc: Linus Torvalds , Nick Piggin , Andrew Morton , Wu Fengguang , Ingo Molnar , linux-mm@kvack.org List-ID: On Tue, Jun 23, 2009 at 01:49:05PM +0100, Hugh Dickins wrote: > handle_mm_fault() is now passing fault flags rather than write_access > down to hugetlb_fault(), so better recognize that in hugetlb_fault(), > and in hugetlb_no_page(). > > Signed-off-by: Hugh Dickins Patch looks good and passes libhugetlbfs regression tests. It passes with or without the tests but without this patch, it's only a co-incidence it passes as opposed to designed. Reviewed-by: Mel Gorman > --- > > include/linux/hugetlb.h | 4 ++-- > mm/hugetlb.c | 17 +++++++++-------- > 2 files changed, 11 insertions(+), 10 deletions(-) > > --- 2.6.30-git20/include/linux/hugetlb.h 2009-06-23 11:06:22.000000000 +0100 > +++ linux/include/linux/hugetlb.h 2009-06-23 13:07:57.000000000 +0100 > @@ -33,7 +33,7 @@ void hugetlb_report_meminfo(struct seq_f > int hugetlb_report_node_meminfo(int, char *); > unsigned long hugetlb_total_pages(void); > int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, > - unsigned long address, int write_access); > + unsigned long address, unsigned int flags); > int hugetlb_reserve_pages(struct inode *inode, long from, long to, > struct vm_area_struct *vma, > int acctflags); > @@ -98,7 +98,7 @@ static inline void hugetlb_report_meminf > #define pud_huge(x) 0 > #define is_hugepage_only_range(mm, addr, len) 0 > #define hugetlb_free_pgd_range(tlb, addr, end, floor, ceiling) ({BUG(); 0; }) > -#define hugetlb_fault(mm, vma, addr, write) ({ BUG(); 0; }) > +#define hugetlb_fault(mm, vma, addr, flags) ({ BUG(); 0; }) > > #define hugetlb_change_protection(vma, address, end, newprot) > > --- 2.6.30-git20/mm/hugetlb.c 2009-06-23 11:06:25.000000000 +0100 > +++ linux/mm/hugetlb.c 2009-06-23 13:07:57.000000000 +0100 > @@ -1985,7 +1985,7 @@ static struct page *hugetlbfs_pagecache_ > } > > static int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma, > - unsigned long address, pte_t *ptep, int write_access) > + unsigned long address, pte_t *ptep, unsigned int flags) > { > struct hstate *h = hstate_vma(vma); > int ret = VM_FAULT_SIGBUS; > @@ -2053,7 +2053,7 @@ retry: > * any allocations necessary to record that reservation occur outside > * the spinlock. > */ > - if (write_access && !(vma->vm_flags & VM_SHARED)) > + if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) > if (vma_needs_reservation(h, vma, address) < 0) { > ret = VM_FAULT_OOM; > goto backout_unlocked; > @@ -2072,7 +2072,7 @@ retry: > && (vma->vm_flags & VM_SHARED))); > set_huge_pte_at(mm, address, ptep, new_pte); > > - if (write_access && !(vma->vm_flags & VM_SHARED)) { > + if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) { > /* Optimization, do the COW without a second fault */ > ret = hugetlb_cow(mm, vma, address, ptep, new_pte, page); > } > @@ -2091,7 +2091,7 @@ backout_unlocked: > } > > int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, > - unsigned long address, int write_access) > + unsigned long address, unsigned int flags) > { > pte_t *ptep; > pte_t entry; > @@ -2112,7 +2112,7 @@ int hugetlb_fault(struct mm_struct *mm, > mutex_lock(&hugetlb_instantiation_mutex); > entry = huge_ptep_get(ptep); > if (huge_pte_none(entry)) { > - ret = hugetlb_no_page(mm, vma, address, ptep, write_access); > + ret = hugetlb_no_page(mm, vma, address, ptep, flags); > goto out_mutex; > } > > @@ -2126,7 +2126,7 @@ int hugetlb_fault(struct mm_struct *mm, > * page now as it is used to determine if a reservation has been > * consumed. > */ > - if (write_access && !pte_write(entry)) { > + if ((flags & FAULT_FLAG_WRITE) && !pte_write(entry)) { > if (vma_needs_reservation(h, vma, address) < 0) { > ret = VM_FAULT_OOM; > goto out_mutex; > @@ -2143,7 +2143,7 @@ int hugetlb_fault(struct mm_struct *mm, > goto out_page_table_lock; > > > - if (write_access) { > + if (flags & FAULT_FLAG_WRITE) { > if (!pte_write(entry)) { > ret = hugetlb_cow(mm, vma, address, ptep, entry, > pagecache_page); > @@ -2152,7 +2152,8 @@ int hugetlb_fault(struct mm_struct *mm, > entry = pte_mkdirty(entry); > } > entry = pte_mkyoung(entry); > - if (huge_ptep_set_access_flags(vma, address, ptep, entry, write_access)) > + if (huge_ptep_set_access_flags(vma, address, ptep, entry, > + flags & FAULT_FLAG_WRITE)) > update_mmu_cache(vma, address, entry); > > out_page_table_lock: > > -- > 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 > -- Mel Gorman Part-time Phd Student Linux Technology Center University of Limerick IBM Dublin Software Lab -- 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail203.messagelabs.com (mail203.messagelabs.com [216.82.254.243]) by kanga.kvack.org (Postfix) with ESMTP id 62DD66B004F for ; Mon, 6 Jul 2009 02:57:06 -0400 (EDT) Date: Mon, 6 Jul 2009 09:31:48 +0200 From: Nick Piggin Subject: Re: handle_mm_fault() calling convention cleanup.. Message-ID: <20090706073148.GJ2714@wotan.suse.de> References: <1246664107.7551.11.camel@pasglop> <1246741718.7551.22.camel@pasglop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1246741718.7551.22.camel@pasglop> Sender: owner-linux-mm@kvack.org To: Benjamin Herrenschmidt Cc: Linus Torvalds , linux-arch@vger.kernel.org, Hugh Dickins , Andrew Morton , linux-mm@kvack.org, Wu Fengguang , Ingo Molnar List-ID: On Sun, Jul 05, 2009 at 07:08:38AM +1000, Benjamin Herrenschmidt wrote: > On Sat, 2009-07-04 at 09:44 -0700, Linus Torvalds wrote: > > > Just a tiny word of warning: right now, the conversion I did pretty much > > depended on the fact that even if I missed a spot, it wouldn't actually > > make any difference. If somebody used "flags" as a binary value (ie like > > the old "write_access" kind of semantics), things would still all work, > > because it was still a "zero-vs-nonzero" issue wrt writes. > > .../... > > Right. Oh well.. we'll see when I get to it. I have a few higher > priority things on my pile at the moment. I have no problems with that. I'd always intended to have flags go further up the call chain like Linus did (since we'd discussed perhaps making faults interruptible and requiring an extra flag to distinguish get_user_pages callers that were not interruptible). So yes adding more flags to improve code or make things simpler is fine by me :) Thanks, Nick -- 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