From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753555AbdKIRPp (ORCPT ); Thu, 9 Nov 2017 12:15:45 -0500 Received: from mail-pf0-f172.google.com ([209.85.192.172]:44732 "EHLO mail-pf0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753482AbdKIRPm (ORCPT ); Thu, 9 Nov 2017 12:15:42 -0500 X-Google-Smtp-Source: ABhQp+QD87fSLIAxWahUu0rR+Ou6jQrkgB33CHhygHJleV77nOTT0siOHZ36LtY0Jpx9LUMcAbb4tg== Date: Fri, 10 Nov 2017 04:15:26 +1100 From: Nicholas Piggin To: "Kirill A. Shutemov" Cc: "Aneesh Kumar K.V" , Florian Weimer , "Kirill A. Shutemov" , linuxppc-dev@lists.ozlabs.org, linux-mm , Andrew Morton , Andy Lutomirski , Dave Hansen , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , linux-arch@vger.kernel.org, Ingo Molnar , Linux Kernel Mailing List Subject: Re: POWER: Unexpected fault when writing to brk-allocated memory Message-ID: <20171110041526.6137bc9a@roar.ozlabs.ibm.com> In-Reply-To: <20171107140158.iz4b2lchhrt6eobe@node.shutemov.name> References: <24b93038-76f7-33df-d02e-facb0ce61cd2@redhat.com> <20171106192524.12ea3187@roar.ozlabs.ibm.com> <546d4155-5b7c-6dba-b642-29c103e336bc@redhat.com> <20171107160705.059e0c2b@roar.ozlabs.ibm.com> <20171107111543.ep57evfxxbwwlhdh@node.shutemov.name> <20171107222228.0c8a50ff@roar.ozlabs.ibm.com> <20171107122825.posamr2dmzlzvs2p@node.shutemov.name> <20171108002448.6799462e@roar.ozlabs.ibm.com> <2ce0a91c-985c-aad8-abfa-e91bc088bb3e@linux.vnet.ibm.com> <20171107140158.iz4b2lchhrt6eobe@node.shutemov.name> Organization: IBM X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 7 Nov 2017 17:01:58 +0300 "Kirill A. Shutemov" wrote: > On Tue, Nov 07, 2017 at 07:15:58PM +0530, Aneesh Kumar K.V wrote: > > > > > > > > If it is decided to keep these kind of heuristics, can we get just a > > > small but reasonably precise description of each change to the > > > interface and ways for using the new functionality, such that would be > > > suitable for the man page? I couldn't fix powerpc because nothing > > > matches and even Aneesh and you differ on some details (MAP_FIXED > > > behaviour). > > > > > > I would consider MAP_FIXED as my mistake. We never discussed this explicitly > > and I kind of assumed it to behave the same way. ie, we search in lower > > address space (128TB) if the hint addr is below 128TB. > > > > IIUC we agree on the below. > > > > 1) MAP_FIXED allow the addr to be used, even if hint addr is below 128TB but > > hint_addr + len is > 128TB. > > > > 2) For everything else we search in < 128TB space if hint addr is below > > 128TB > > > > 3) We don't switch to large address space if hint_addr + len > 128TB. The > > decision to switch to large address space is primarily based on hint addr > > > > Is there any other rule we need to outline? Or is any of the above not > > correct? > > That's correct. > Thanks guys, I'll send out some powerpc patches to match -- it deviates in its MAP_FIXED handling (treats it the same as !MAP_FIXED). So these semantics are what we're going with? Anything that does mmap() is guaranteed of getting a 47-bit pointer and it can use the top 17 bits for itself? Is intended to be cross-platform or just x86 and power specific? Also, this may follow from deduction from 1-3, but for explicit specification in man page: 4) To get an unspecified allocation with the largest possible address range, we pass in -1 for mmap hint. Are we allowing 8 bits bits of unused address in this case, or must the app not assume anything about number of bits used? Thanks, Nick