Received: by 10.223.176.46 with SMTP id f43csp538303wra; Wed, 24 Jan 2018 02:04:25 -0800 (PST) X-Google-Smtp-Source: AH8x224An00GiT+aXKhz1YsEkv6h1Cd1LpQAJ++31Q14LowMFlzAbfZIC4h2I0AQ1k7QI7RnK71F X-Received: by 2002:a17:902:e65:: with SMTP id 92-v6mr4786380plw.148.1516788265600; Wed, 24 Jan 2018 02:04:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516788265; cv=none; d=google.com; s=arc-20160816; b=VI1aNpwYyEaJPnaj6HET1xmfgTlUgFD+jdlfzWwXWAXfzNCestY5l2nE+TT+i8YlKX w08M5Vo3ZnjlbfB0iVzvH7BFScIT0AeVBv5zZ+b5UWduvQrtzQa9QW2du2QAl73TE9Z7 e1IoegBcWNz0c+SoInTJP/w6CTszZpYqnq+cs8Zfn8iy1B4WKdxIj68v0pa6N2OkEhKS JkC9me/biuPY7vOjo4swft2jZ54vodQfvmQDkXfdk/Rtgwe/jD4UX1EwsITpoJkjlboo v9SYSWeGwlDeLoxY1d/03SAMsuP+XDv4E5T6XeFpWCLY5uJGjcAxIojpNQmvHXwh9TVV JfnQ== 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=baIV3uKq4XOgvNoo9wGg1MkexK6z+fy+oRWNo+g+RNY=; b=IpIu7I62qwMdyv0NDlBWPfkd3prmqjDke4qusbhk73+jYTJnL20BOBwuiHaf/oif0p BSH9ug803/qwHWzKpaZ0NbtQ8S4t6BinRplF9obFYAmb8+WI8jFqPMe1SJWnwSUKcb/P nlsX4MMZlRX9vZw5ln7g5B5kyj4vIbmpFROw3RwH2mX8imQ+ewGtWp5JVVCfqV65raa1 CBFe6fVGiyKcV/nncpgjaf8J2XbPB/mJFiTeLJGxp17YOPu1kF6/QVVxDhvwjsmRlfO/ Jr1rtV3sI+LiSdXwvkC8NBEU0jln3hSrA1Oj9+TrWllSJVH5NJ6gBfNeg5/eVOCO/miH QtCQ== 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 q7si2663733pfh.74.2018.01.24.02.04.11; Wed, 24 Jan 2018 02:04:25 -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 S932696AbeAXKDM (ORCPT + 99 others); Wed, 24 Jan 2018 05:03:12 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:9436 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320AbeAXKDJ (ORCPT ); Wed, 24 Jan 2018 05:03:09 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 3zRLMP6wnKz9ttrZ; Wed, 24 Jan 2018 11:02:57 +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 sregYQ0wLUfF; Wed, 24 Jan 2018 11:02:57 +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 3zRLMP6Nmfz9ttrY; Wed, 24 Jan 2018 11:02:57 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 5EE6F8B983; Wed, 24 Jan 2018 11:03:08 +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 YWwPrO0b8eWY; Wed, 24 Jan 2018 11:03:08 +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 D6E028B867; Wed, 24 Jan 2018 11:03:07 +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> <47bbd8be-7b2e-245b-08d9-24958eec2ed2@linux.vnet.ibm.com> From: Christophe LEROY Message-ID: <03c7f5ce-c2ed-7038-3a8b-3bb7a9a4a2dc@c-s.fr> Date: Wed, 24 Jan 2018 11:03:07 +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: <47bbd8be-7b2e-245b-08d9-24958eec2ed2@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:51, Aneesh Kumar K.V a écrit : > > > On 01/24/2018 03:09 PM, Christophe LEROY wrote: >> >> >> Le 24/01/2018 à 10:35, Aneesh Kumar K.V a écrit : >>> > >>>> 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. >> >> > > Now that explains is better. But then the requested HEAPBASE was not > free and hence topdown search got an address in the below range. > > 7efffd000000-7f0000000000 rw-p 00000000 00:0d 1082770 /anon_hugepage > (deleted) > > > The new range allocated is such that there is no scope for expansion of > heap if we do a topdown search. But why should that require us to change > from topdown/bottomup search? > > > 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 > 7efffd000000-7f0000000000 rw-p 00000000 00:0d 1082770 /anon_hugepage > (deleted) > 7ffff2d40000-7ffff7d60000 rw-p 00000000 00:00 0 > 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] > > > For the specific test, one should pass the HEAPBASE value such that it > can be expanded if required isn't it ? For the test, yes, it is dumb to pass an unusable HEAPBASE, but what happens in real life: * PPC32: No HEAPBASE, hugetlbfs defines a HEAPBASE at sbrk(0) + PAGE_SIZE = 0x10800000 ==> This is in the same slice as already allocated ==> the kernel does as if mmap() had been called with no hint address and allocates something unusable instead. * PPC64: No HEAPBASE, hugetlbfs seems to define a HEAPBASE at 100000000000, which doesn't conflict with an already allocated mapping ==> it works. Now, when we take the generic case, ie when slice is not activated, when you call mmap() without a hint address, it allocates a suitable address because it does bottom-up. Why do differently with slices ? Christophe