From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74291C433E0 for ; Mon, 25 Jan 2021 04:09:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 672AE20727 for ; Mon, 25 Jan 2021 04:09:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 672AE20727 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B03EF8D0003; Sun, 24 Jan 2021 23:09:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AB5808D0001; Sun, 24 Jan 2021 23:09:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9CB578D0003; Sun, 24 Jan 2021 23:09:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0087.hostedemail.com [216.40.44.87]) by kanga.kvack.org (Postfix) with ESMTP id 86E508D0001 for ; Sun, 24 Jan 2021 23:09:07 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4983B8249980 for ; Mon, 25 Jan 2021 04:09:07 +0000 (UTC) X-FDA: 77742967134.19.bath17_2e0973e27582 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin19.hostedemail.com (Postfix) with ESMTP id 2E3D91AD31E for ; Mon, 25 Jan 2021 04:09:07 +0000 (UTC) X-HE-Tag: bath17_2e0973e27582 X-Filterd-Recvd-Size: 6367 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Mon, 25 Jan 2021 04:09:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description; bh=+IJV3bEfZ7kR0QePaso8V0y8l7olQ2am3PHLp7mjaRk=; b=P/iaNSkwB7i3Vy7vJfDCjMsweS xHuL9HuKIv3j4vS9CVemwEi4aJW+VXHPhkvmHlRF0nLhZqtylwMkIlMvErBn+iAxt2UIZff+o7RGS s8RtUiG/PTSJYPN8EpF/Oi2CwfXTLsdAtRowR9lwR+KNqwuZQwuF4X56t8k95/SYycRYTcIgRbNjM r6fBCZITTai9e+6jxL0ICLZyfKa3JNc3SpWDixf1x32YjxUwN6lcZsTjI7Y9RDkiNxtuhzy+rImqP u+bVbFOMu2aWa4kms1lmQ94LONlSnADzHivTgXjExKPRzhtQ7GkZVq1NPOH4bC9BZa9TWvQYQv5y/ 5mmcnKJw==; Received: from [2601:1c0:6280:3f0::7650] by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1l3tBR-0000iE-Pd; Mon, 25 Jan 2021 04:08:58 +0000 Subject: Re: [External] Re: [PATCH v13 02/12] mm: hugetlb: introduce a new config HUGETLB_PAGE_FREE_VMEMMAP To: Muchun Song , David Rientjes Cc: Jonathan Corbet , Mike Kravetz , Thomas Gleixner , mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com, dave.hansen@linux.intel.com, luto@kernel.org, Peter Zijlstra , viro@zeniv.linux.org.uk, Andrew Morton , paulmck@kernel.org, mchehab+huawei@kernel.org, pawan.kumar.gupta@linux.intel.com, oneukum@suse.com, anshuman.khandual@arm.com, jroedel@suse.de, Mina Almasry , Matthew Wilcox , Oscar Salvador , Michal Hocko , "Song Bao Hua (Barry Song)" , David Hildenbrand , =?UTF-8?B?SE9SSUdVQ0hJIE5BT1lBKOWggOWPoyDnm7TkuZ8p?= , Xiongchun duan , linux-doc@vger.kernel.org, LKML , Linux Memory Management List , linux-fsdevel References: <20210117151053.24600-1-songmuchun@bytedance.com> <20210117151053.24600-3-songmuchun@bytedance.com> <472a58b9-12cb-3c3-d132-13dbae5174f0@google.com> From: Randy Dunlap Message-ID: Date: Sun, 24 Jan 2021 20:08:45 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 1/24/21 8:06 PM, Muchun Song wrote: > On Mon, Jan 25, 2021 at 7:58 AM David Rientjes wrote: >> >> >> On Sun, 17 Jan 2021, Muchun Song wrote: >> >>> The HUGETLB_PAGE_FREE_VMEMMAP option is used to enable the freeing >>> of unnecessary vmemmap associated with HugeTLB pages. The config >>> option is introduced early so that supporting code can be written >>> to depend on the option. The initial version of the code only >>> provides support for x86-64. >>> >>> Like other code which frees vmemmap, this config option depends on >>> HAVE_BOOTMEM_INFO_NODE. The routine register_page_bootmem_info() is >>> used to register bootmem info. Therefore, make sure >>> register_page_bootmem_info is enabled if HUGETLB_PAGE_FREE_VMEMMAP >>> is defined. >>> >>> Signed-off-by: Muchun Song >>> Reviewed-by: Oscar Salvador >>> Acked-by: Mike Kravetz >>> --- >>> arch/x86/mm/init_64.c | 2 +- >>> fs/Kconfig | 18 ++++++++++++++++++ >>> 2 files changed, 19 insertions(+), 1 deletion(-) >>> >>> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c >>> index 0a45f062826e..0435bee2e172 100644 >>> --- a/arch/x86/mm/init_64.c >>> +++ b/arch/x86/mm/init_64.c >>> @@ -1225,7 +1225,7 @@ static struct kcore_list kcore_vsyscall; >>> >>> static void __init register_page_bootmem_info(void) >>> { >>> -#ifdef CONFIG_NUMA >>> +#if defined(CONFIG_NUMA) || defined(CONFIG_HUGETLB_PAGE_FREE_VMEMMAP) >>> int i; >>> >>> for_each_online_node(i) >>> diff --git a/fs/Kconfig b/fs/Kconfig >>> index 976e8b9033c4..e7c4c2a79311 100644 >>> --- a/fs/Kconfig >>> +++ b/fs/Kconfig >>> @@ -245,6 +245,24 @@ config HUGETLBFS >>> config HUGETLB_PAGE >>> def_bool HUGETLBFS >>> >>> +config HUGETLB_PAGE_FREE_VMEMMAP >>> + def_bool HUGETLB_PAGE >> >> I'm not sure I understand the rationale for providing this help text if >> this is def_bool depending on CONFIG_HUGETLB_PAGE. Are you intending that >> this is actually configurable and we want to provide guidance to the admin >> on when to disable it (which it currently doesn't)? If not, why have the >> help text? > > This is __not__ configurable. Seems like a comment to help others > understand this option. Like Randy said. Yes, it could be written with '#' (or "comment") comment syntax instead of as help text. thanks. >> >>> + depends on X86_64 >>> + depends on SPARSEMEM_VMEMMAP >>> + depends on HAVE_BOOTMEM_INFO_NODE >>> + help >>> + The option HUGETLB_PAGE_FREE_VMEMMAP allows for the freeing of >>> + some vmemmap pages associated with pre-allocated HugeTLB pages. >>> + For example, on X86_64 6 vmemmap pages of size 4KB each can be >>> + saved for each 2MB HugeTLB page. 4094 vmemmap pages of size 4KB >>> + each can be saved for each 1GB HugeTLB page. >>> + >>> + When a HugeTLB page is allocated or freed, the vmemmap array >>> + representing the range associated with the page will need to be >>> + remapped. When a page is allocated, vmemmap pages are freed >>> + after remapping. When a page is freed, previously discarded >>> + vmemmap pages must be allocated before remapping. >>> + >>> config MEMFD_CREATE >>> def_bool TMPFS || HUGETLBFS >>> > -- ~Randy