From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967050AbbBDRrU (ORCPT ); Wed, 4 Feb 2015 12:47:20 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55724 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966663AbbBDRrT (ORCPT ); Wed, 4 Feb 2015 12:47:19 -0500 Date: Wed, 4 Feb 2015 12:47:05 -0500 From: Luiz Capitulino To: "Kirill A. Shutemov" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Naoya Horiguchi , Andi Kleen , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Subject: Re: [PATCH] hugetlb, x86: register 1G page size if we can allocate them runtime Message-ID: <20150204124705.21f669bd@redhat.com> In-Reply-To: <1423050871-122636-1-git-send-email-kirill.shutemov@linux.intel.com> References: <1423050871-122636-1-git-send-email-kirill.shutemov@linux.intel.com> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 Feb 2015 13:54:31 +0200 "Kirill A. Shutemov" wrote: > After commit 944d9fec8d7a we can allocate 1G pages runtime if CMA is > enabled. > > Let's register 1G pages into hugetlb even if user hasn't requested them > explicitly at boot time with hugepagesz=1G. > > Signed-off-by: Kirill A. Shutemov > Cc: Luiz Capitulino > Cc: Naoya Horiguchi > Cc: Andi Kleen > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: "H. Peter Anvin" > --- > arch/x86/mm/hugetlbpage.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/arch/x86/mm/hugetlbpage.c b/arch/x86/mm/hugetlbpage.c > index 9161f764121e..42982b26e32b 100644 > --- a/arch/x86/mm/hugetlbpage.c > +++ b/arch/x86/mm/hugetlbpage.c > @@ -172,4 +172,15 @@ static __init int setup_hugepagesz(char *opt) > return 1; > } > __setup("hugepagesz=", setup_hugepagesz); > + > +#ifdef CONFIG_CMA > +static __init int gigantic_pages_init(void) > +{ > + /* With CMA we can allocate gigantic pages at runtime */ > + if (cpu_has_gbpages && !size_to_hstate(1UL << PUD_SHIFT)) > + hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT); > + return 0; > +} > +arch_initcall(gigantic_pages_init); > +#endif > #endif Very nice! I was thinking about this for a long time but I don't think my implementation would be that simple: Reviewed-by: Luiz Capitulino