Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5092454img; Wed, 27 Mar 2019 01:47:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyS+WvdBfTwwYQ7ejesrH7NslO4czFUkdtKYFZRIBCMlWmoMQ2GsT6oXZHahWZMOonMnW1y X-Received: by 2002:a17:902:b481:: with SMTP id y1mr35907502plr.338.1553676476160; Wed, 27 Mar 2019 01:47:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553676476; cv=none; d=google.com; s=arc-20160816; b=W4ORz0mc79hY1MOJaX0vmo9BMUeYWrYfMiU9xb7fI0bytqWfEjsWL+UWLyUCNvKb1p /xvLr8xTjYTq8QFoPQuIc9SL1autpzi1SHdSSVvrdiLdDhXSME6dpOctdFHlJWiLNExy nN61e4P7avEw7H4SyYwGWHXVjAl5u5SFZiBNQ8sQ3OIH+WhDiOJcZ99/1jCqAYAOl8gO Xn/h6fx0zLV2QDO2+UR9qUUyKCx4bEh9f5D9ikYOlWxtIifqg+F7NITbWel2yzq43Q3E JK+IyNIK/5dm8Do6N5zBp+EI9DXDj5Zpb2bwMNv3Xq0nVQBbqd0w1ujjUGY1LaneIGNa RM9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=aZ4XjenjOWwY5Allx5WgjsAlXn+yjTfQ/prclQMlcVQ=; b=DYoFbrWqwwC6ClElhs5TSUph1/2JdR37IlKD930AlBBD0Evkhm5f+i9BMUNtASnDV7 7kH5rciUWfWh3ZAtu/2orL3UftKrNPRN8DLOAsVoa4mwAtThpdxs6c8Uv9l/pWXtfEOp HPfJmQsM7c3pe+GHVBn6pnBB08vGPPBDN3zf2BYdCMpAK3nQeDUSDVjSgYslKmKS4u2T MgWqrHO7m4iLaC6BGkkeyYpmlnaWJeV5ndZpijE0fZ/MdZi2dhHPxQpPCwQRc1eg/0bj V/K0KFjpigZ8VewhzgsiQfRK7jsAPvpXBqvmqW/UYleOHewEkZdw+3DL39sfwlfNZ8Ja k1pA== 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 c26si9047129pfd.155.2019.03.27.01.47.40; Wed, 27 Mar 2019 01:47:56 -0700 (PDT) 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 S1733194AbfC0Ip1 (ORCPT + 99 others); Wed, 27 Mar 2019 04:45:27 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:60311 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733178AbfC0IpY (ORCPT ); Wed, 27 Mar 2019 04:45:24 -0400 X-Originating-IP: 81.250.144.103 Received: from [10.30.1.20] (lneuilly-657-1-5-103.w81-250.abo.wanadoo.fr [81.250.144.103]) (Authenticated sender: alex@ghiti.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 8DB451C0004; Wed, 27 Mar 2019 08:45:15 +0000 (UTC) Subject: Re: [PATCH v8 4/4] hugetlb: allow to free gigantic pages regardless of the configuration To: "Aneesh Kumar K.V" , mpe@ellerman.id.au, Andrew Morton , Vlastimil Babka , Catalin Marinas , Will Deacon , Benjamin Herrenschmidt , Paul Mackerras , Martin Schwidefsky , Heiko Carstens , Yoshinori Sato , Rich Felker , "David S . Miller" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , x86@kernel.org, Dave Hansen , Andy Lutomirski , Peter Zijlstra , Mike Kravetz , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org References: <20190327063626.18421-1-alex@ghiti.fr> <20190327063626.18421-5-alex@ghiti.fr> From: Alexandre Ghiti Message-ID: Date: Wed, 27 Mar 2019 09:44:56 +0100 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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: fr Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/27/2019 08:01 AM, Aneesh Kumar K.V wrote: > On 3/27/19 12:06 PM, Alexandre Ghiti wrote: >> On systems without CONTIG_ALLOC activated but that support gigantic >> pages, >> boottime reserved gigantic pages can not be freed at all. This patch >> simply enables the possibility to hand back those pages to memory >> allocator. >> >> Signed-off-by: Alexandre Ghiti >> Acked-by: David S. Miller [sparc] >> >> diff --git a/arch/powerpc/include/asm/book3s/64/hugetlb.h >> b/arch/powerpc/include/asm/book3s/64/hugetlb.h >> index ec2a55a553c7..7013284f0f1b 100644 >> --- a/arch/powerpc/include/asm/book3s/64/hugetlb.h >> +++ b/arch/powerpc/include/asm/book3s/64/hugetlb.h >> @@ -36,8 +36,8 @@ static inline int hstate_get_psize(struct hstate >> *hstate) >>       } >>   } >>   -#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE >> -static inline bool gigantic_page_supported(void) >> +#define __HAVE_ARCH_GIGANTIC_PAGE_RUNTIME_SUPPORTED >> +static inline bool gigantic_page_runtime_supported(void) >>   { >>       /* >>        * We used gigantic page reservation with hypervisor assist in >> some case. >> @@ -49,7 +49,6 @@ static inline bool gigantic_page_supported(void) >>         return true; >>   } >> -#endif >>     /* hugepd entry valid bit */ >>   #define HUGEPD_VAL_BITS        (0x8000000000000000UL) > > Is that correct when CONTIG_ALLOC is not enabled? I guess we want > > gigantic_page_runtime_supported to return false when CONTIG_ALLOC is > not enabled on all architectures and on POWER when it is enabled we > want it to be conditional as it is now. > > -aneesh > CONFIG_ARCH_HAS_GIGANTIC_PAGE is set by default when an architecture supports gigantic pages: on its own, it allows to allocate boottime gigantic pages AND to free them at runtime (this is the goal of this series), but not to allocate runtime gigantic pages. If CONTIG_ALLOC is set, it allows in addition to allocate runtime gigantic pages. I re-introduced the runtime checks because we can't know at compile time if powerpc can or not support gigantic pages. So for all architectures, gigantic_page_runtime_supported only depends on CONFIG_ARCH_HAS_GIGANTIC_PAGE enabled or not. The possibility to allocate runtime gigantic pages is dealt with after those runtime checks. By the way, I forgot to ask you why you think that if an arch cannot allocate runtime gigantic pages, it should not be able to free boottime gigantic pages ?