[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171108083038.djj3qdhhnrazkk7b@node.shutemov.name>
Date: Wed, 8 Nov 2017 11:30:38 +0300
From: "Kirill A. Shutemov" <kirill@...temov.name>
To: Michael Ellerman <mpe@...erman.id.au>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>,
Nicholas Piggin <npiggin@...il.com>,
Florian Weimer <fweimer@...hat.com>,
linux-arch@...r.kernel.org, Dave Hansen <dave.hansen@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Ingo Molnar <mingo@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...capital.net>,
linux-mm <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linuxppc-dev@...ts.ozlabs.org,
Thomas Gleixner <tglx@...utronix.de>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Subject: Re: POWER: Unexpected fault when writing to brk-allocated memory
On Wed, Nov 08, 2017 at 03:56:06PM +1100, Michael Ellerman wrote:
> "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com> writes:
>
> >>
> >> 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.
>
> So:
> mmap(0x7ffffffff000, 0x2000, ..., MAP_FIXED ...) = 0x7ffffffff000
>
> > 2) For everything else we search in < 128TB space if hint addr is below
> > 128TB
>
> mmap((x < 128T), 0x1000, ...) = (y < 128T)
> ...
> mmap(0x7ffffffff000, 0x1000, ...) = 0x7ffffffff000
> mmap(0x800000000000, 0x1000, ...) = 0x800000000000
> ...
> mmap((x >= 128T), 0x1000, ...) = (y >= 128T)
>
> > 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
>
> But does the mmap succeed in that case or not?
>
> ie: mmap(0x7ffffffff000, 0x2000, ...) = ?
It does, but resulting address doesn't match the hint. It's somewhere
below 47-bit border.
--
Kirill A. Shutemov
Powered by blists - more mailing lists