Received: by 10.223.176.46 with SMTP id f43csp516759wra; Wed, 24 Jan 2018 01:39:54 -0800 (PST) X-Google-Smtp-Source: AH8x225cGm4WaGo4Fl/lD2mSQkNJ8XIVSe+j1sgX/SvfdSbPCIkT3rlFVaK7Y1Sicb3XhirKL2hD X-Received: by 10.101.98.26 with SMTP id d26mr10631264pgv.416.1516786794109; Wed, 24 Jan 2018 01:39:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516786794; cv=none; d=google.com; s=arc-20160816; b=0hIT0+KMu2Y7dArVUX/mYizDvTMNR9vu1X0SQAfOMhKvVw+uyDGKKEJR6+SzptSRN5 Gd1m/+8zaA8THTyy0hY7Gg6l4kKxEH+C2kE0D/Qn31sqCKO2N/+FzHrrd/uGuqBQqEYt wG8n0cW4OWSYHJMWJf0mk7/iNhjE7RtKJS+tr9Wv9VC1IE2nKf4IQnV3umD9j3mq4KxO BskdWL389CcTQc0FwQjcsY+Ds4FNxCS98tGP+VFx69tw7Z1lgLERyk73m3PVPZYrTYgW aqGv7v96UYnFsm2s+d4YcHg0TYg8jqovQZTipFSxiAoWFAxUmeYxLKReIydlVPLQDlH3 D8yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=BBee0HmsxgBMLHCZeFG10PYVpzsFCcce4fk31sZZlw8=; b=09bMssF3PwerlZkVXd6DPPEG09BBTCxx2acvmcEnuV56l2XyWHdl6S+6eg8hCzhbJT fovWAO45b81s5p1/tFuZbxT3EGMqE3X1NwXhXlFr3JGsmx1eMS+QiFmoNesvtl/4ykUm 4NRszwtzPbL4SVrXBS0/Ikj69WVYlXvVRO6lUQ3Z3gB4+nKlRQW+rzxiU6VnowoD+mmf xHWCqyevnSSnqqRDe6XxggJ+vjkKOYmIb+NddRWZ/07QggruDFtDON6cWB5w1kU82F+A NoLVydUPVJQj0i0bgIULlxYBO1Q5AFGuBpKJW35bGjOOUVdwbWPEF7NdJOigv9GWai3y q0rA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a2si2651227pfa.307.2018.01.24.01.39.40; Wed, 24 Jan 2018 01:39:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932921AbeAXJjS (ORCPT + 99 others); Wed, 24 Jan 2018 04:39:18 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:38366 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932606AbeAXJjO (ORCPT ); Wed, 24 Jan 2018 04:39:14 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 3zRKqp1cgFz9tttJ; Wed, 24 Jan 2018 10:39:02 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id kLmJf4PLgqFy; Wed, 24 Jan 2018 10:39:02 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 3zRKqp0Tvxz9tttF; Wed, 24 Jan 2018 10:39:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7DCED8B867; Wed, 24 Jan 2018 10:39:12 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id lF7M3UYlhiX7; Wed, 24 Jan 2018 10:39:12 +0100 (CET) Received: from PO15451 (po15451.idsi0.si.c-s.fr [172.25.231.40]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 027118B983; Wed, 24 Jan 2018 10:39:11 +0100 (CET) Subject: Re: [PATCH v3 5/5] powerpc/mm: Fix growth direction for hugepages mmaps with slice To: "Aneesh Kumar K.V" , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Scott Wood Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org References: <6920f6efe2dcdabf59350b2d31ee6bd4bdef57f4.1516783089.git.christophe.leroy@c-s.fr> <362a93307a09b521878c47a8999a39a228184293.1516783089.git.christophe.leroy@c-s.fr> <9aea8b6f-0d1a-b700-efe4-8efcebc5d16d@linux.vnet.ibm.com> From: Christophe LEROY Message-ID: Date: Wed, 24 Jan 2018 10:39:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <9aea8b6f-0d1a-b700-efe4-8efcebc5d16d@linux.vnet.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 24/01/2018 à 10:35, Aneesh Kumar K.V a écrit : > > > On 01/24/2018 02:57 PM, Christophe LEROY wrote: >> >> >> Le 24/01/2018 à 10:15, Aneesh Kumar K.V a écrit : >>> >>> >>> On 01/24/2018 02:32 PM, Christophe Leroy wrote: >>>> 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 >>>> [...] >>>> >>>> As one can see from the above strace log, mmap() allocates further >>>> pages below the initial one because no space is available on top of it. >>>> >>>> This patch fixes it by requesting bottomup mapping as the non >>>> generic hugetlb_get_unmapped_area() does >>>> >>>> Fixes: d0f13e3c20b6f ("[POWERPC] Introduce address space "slices" ") >>>> Signed-off-by: Christophe Leroy >>>> --- >>>>   v3: Was a standalone patch before, but conflicts with this serie. >>>> >>>>   arch/powerpc/mm/hugetlbpage.c | 2 +- >>>>   1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/arch/powerpc/mm/hugetlbpage.c >>>> b/arch/powerpc/mm/hugetlbpage.c >>>> index 79e1378ee303..368ea6b248ad 100644 >>>> --- a/arch/powerpc/mm/hugetlbpage.c >>>> +++ b/arch/powerpc/mm/hugetlbpage.c >>>> @@ -558,7 +558,7 @@ 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, 0); >>>>   } >>>>   #endif >>> >>> Why make this change also for PPC64? Can you do this #ifdef 8xx?.You >>> can ideally move hugetlb_get_unmapped_area to slice.h and then make >>> this much simpler for 8xxx? >>> >> >> Did you try with HUGETLB_MORECORE_HEAPBASE=0x11000000 on PPC64 as I >> suggested in my last email on this subject (22/01/2018 9:22) ? > > > yes. The test ran fine for me You tried with 0x30000000, it works as well on PPC32. I'd really like you to try with 0x11000000 which is in the same slice as the 10020000-10030000 range. Christophe > > kvaneesh@ltctulc6a-p1:[~]$  HUGETLB_MORECORE=yes > HUGETLB_MORECORE_HEAPBASE=0x30000000 ./a.out > 10000000-10010000 r-xp 00000000 fc:00 9044312 /home/kvaneesh/a.out > 10010000-10020000 r--p 00000000 fc:00 9044312 /home/kvaneesh/a.out > 10020000-10030000 rw-p 00010000 fc:00 9044312 /home/kvaneesh/a.out > 30000000-33000000 rw-p 00000000 00:0d 1062697 /anon_hugepage (deleted) > 33000000-35000000 rw-p 03000000 00:0d 1062698 /anon_hugepage (deleted) > 35000000-37000000 rw-p 05000000 00:0d 1062699 /anon_hugepage (deleted) > 7ffff7d60000-7ffff7f10000 r-xp 00000000 fc:00 9250090 > /lib/powerpc64le-linux-gnu/libc-2.23.so > 7ffff7f10000-7ffff7f20000 r--p 001a0000 fc:00 9250090 > /lib/powerpc64le-linux-gnu/libc-2.23.so > 7ffff7f20000-7ffff7f30000 rw-p 001b0000 fc:00 9250090 > /lib/powerpc64le-linux-gnu/libc-2.23.so > 7ffff7f40000-7ffff7f60000 r-xp 00000000 fc:00 10754812 > /usr/lib/libhugetlbfs.so.0 > 7ffff7f60000-7ffff7f70000 r--p 00010000 fc:00 10754812 > /usr/lib/libhugetlbfs.so.0 > 7ffff7f70000-7ffff7f80000 rw-p 00020000 fc:00 10754812 > /usr/lib/libhugetlbfs.so.0 > 7ffff7f80000-7ffff7fa0000 r-xp 00000000 00:00 0 [vdso] > 7ffff7fa0000-7ffff7fe0000 r-xp 00000000 fc:00 9250107 > /lib/powerpc64le-linux-gnu/ld-2.23.so > 7ffff7fe0000-7ffff7ff0000 r--p 00030000 fc:00 9250107 > /lib/powerpc64le-linux-gnu/ld-2.23.so > 7ffff7ff0000-7ffff8000000 rw-p 00040000 fc:00 9250107 > /lib/powerpc64le-linux-gnu/ld-2.23.so > 7ffffffd0000-800000000000 rw-p 00000000 00:00 0 [stack] > > >> >> Before doing anything specific to the PPC32/8xx, I'd like to be sure >> the issue is definitly only on PPC32. >> > > I am not sure I understand the problem correctly. If there is a free > space in the required range, both topdown/bottomup search should be able > to find it. Unless topdown found another free area suitable for hugetlb > allocation above. My take is we should not change the topdown to > bottomup without really understanding the failure scenarios. > > -aneesh