From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932850AbeAXJP1 (ORCPT ); Wed, 24 Jan 2018 04:15:27 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58288 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932821AbeAXJPX (ORCPT ); Wed, 24 Jan 2018 04:15:23 -0500 Subject: Re: [PATCH v3 5/5] powerpc/mm: Fix growth direction for hugepages mmaps with slice To: Christophe Leroy , 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> From: "Aneesh Kumar K.V" Date: Wed, 24 Jan 2018 14:45:12 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <362a93307a09b521878c47a8999a39a228184293.1516783089.git.christophe.leroy@c-s.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 18012409-0024-0000-0000-000017D654CB X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008418; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000247; SDB=6.00979590; UDB=6.00496525; IPR=6.00758895; BA=6.00005793; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00019179; XFM=3.00000015; UTC=2018-01-24 09:15:19 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18012409-0025-0000-0000-00004E6DB7B4 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-24_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801240126 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? -aneesh -aneesh