From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Christophe Leroy <christophe.leroy@c-s.fr>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Scott Wood <oss@buserror.net>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] powerpc/mm: Fix growth direction for hugepages mmaps with slice
Date: Tue, 16 Jan 2018 21:33:48 +0530 [thread overview]
Message-ID: <87wp0haizf.fsf@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180109101810.2471D6C6CF@localhost.localdomain>
Christophe Leroy <christophe.leroy@c-s.fr> writes:
> An application running with libhugetlbfs fails to allocate
> additional pages to HEAP due to the hugemap being done
> inconditionally as topdown mapping:
>
> mmap(0x10080000, 1572864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0) = 0x73e80000
> [...]
> mmap(0x74000000, 1048576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0x180000) = 0x73d80000
> munmap(0x73d80000, 1048576) = 0
> [...]
> mmap(0x74000000, 1572864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0x180000) = 0x73d00000
> munmap(0x73d00000, 1572864) = 0
> [...]
> mmap(0x74000000, 1572864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x40000, -1, 0x180000) = 0x73d00000
> munmap(0x73d00000, 1572864) = 0
> [...]
>
Can you explain the failure details above. I am not sure I understand
what to read from the above output.
> As one can see from the above strace log, mmap() allocates further
> pages below the initial one.
>
> This patch fixes it by taking into account MAP_GROWSDOWN flag.
Rest of the kernel don't depend on that flag to select a topdown search
or not. So what is special with hugetlb? IF we select legacy mmap that
is when we select a bottomup search. Hugetlb on ppc64 always did a
topdown search.
>
> Fixes: d0f13e3c20b6f ("[POWERPC] Introduce address space "slices" ")
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
> v2: Added missing include
>
> arch/powerpc/mm/hugetlbpage.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
> index 79e1378ee303..0eadf9f199de 100644
> --- a/arch/powerpc/mm/hugetlbpage.c
> +++ b/arch/powerpc/mm/hugetlbpage.c
> @@ -19,6 +19,7 @@
> #include <linux/moduleparam.h>
> #include <linux/swap.h>
> #include <linux/swapops.h>
> +#include <linux/mman.h>
> #include <asm/pgtable.h>
> #include <asm/pgalloc.h>
> #include <asm/tlb.h>
> @@ -558,7 +559,8 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
> return radix__hugetlb_get_unmapped_area(file, addr, len,
> pgoff, flags);
> #endif
> - return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1);
> + return slice_get_unmapped_area(addr, len, flags, mmu_psize,
> + flags & MAP_GROWSDOWN);
> }
> #endif
>
> --
> 2.13.3
next prev parent reply other threads:[~2018-01-16 16:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 10:18 [PATCH v2] powerpc/mm: Fix growth direction for hugepages mmaps with slice Christophe Leroy
2018-01-16 16:03 ` Aneesh Kumar K.V [this message]
2018-01-16 16:48 ` Christophe LEROY
2018-01-17 3:19 ` Aneesh Kumar K.V
2018-01-17 11:11 ` Christophe LEROY
[not found] ` <87y3kuz559.fsf@linux.vnet.ibm.com>
2018-01-19 10:05 ` Aneesh Kumar K.V
2018-01-22 8:22 ` Christophe LEROY
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wp0haizf.fsf@linux.vnet.ibm.com \
--to=aneesh.kumar@linux.vnet.ibm.com \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@c-s.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=oss@buserror.net \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).