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.3 required=3.0 tests=BAYES_00, 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 097CAC433E0 for ; Tue, 26 Jan 2021 02:07:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 80A36230FA for ; Tue, 26 Jan 2021 02:07:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 80A36230FA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AC9078D0074; Mon, 25 Jan 2021 21:07:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A77BB8D0065; Mon, 25 Jan 2021 21:07:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 966248D0074; Mon, 25 Jan 2021 21:07:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0249.hostedemail.com [216.40.44.249]) by kanga.kvack.org (Postfix) with ESMTP id 7C6758D0065 for ; Mon, 25 Jan 2021 21:07:26 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 350A21EE6 for ; Tue, 26 Jan 2021 02:07:26 +0000 (UTC) X-FDA: 77746289292.15.rub44_2c0ee052758a Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 0F6201814B0C7 for ; Tue, 26 Jan 2021 02:07:26 +0000 (UTC) X-HE-Tag: rub44_2c0ee052758a X-Filterd-Recvd-Size: 4693 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) by imf05.hostedemail.com (Postfix) with ESMTP for ; Tue, 26 Jan 2021 02:07:24 +0000 (UTC) Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4DPqpT3CBsz7ZQW; Tue, 26 Jan 2021 10:06:09 +0800 (CST) Received: from [10.174.179.117] (10.174.179.117) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.498.0; Tue, 26 Jan 2021 10:07:11 +0800 Subject: Re: [PATCH v13 02/12] mm: hugetlb: introduce a new config HUGETLB_PAGE_FREE_VMEMMAP To: Muchun Song CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , References: <20210117151053.24600-1-songmuchun@bytedance.com> <20210117151053.24600-3-songmuchun@bytedance.com> From: Miaohe Lin Message-ID: <474cca65-c184-293a-a71d-b373aae4dfb1@huawei.com> Date: Tue, 26 Jan 2021 10:07:10 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20210117151053.24600-3-songmuchun@bytedance.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.179.117] X-CFilter-Loop: Reflected 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: Hi: On 2021/1/17 23:10, 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 > + 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 > > LGTM. Thanks. Reviewed-by: Miaohe Lin