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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED 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 53589C433ED for ; Mon, 10 May 2021 03:54:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 29BAF61430 for ; Mon, 10 May 2021 03:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230079AbhEJDzm (ORCPT ); Sun, 9 May 2021 23:55:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:41016 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230029AbhEJDzl (ORCPT ); Sun, 9 May 2021 23:55:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0232860233; Mon, 10 May 2021 03:54:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1620618877; bh=Ax9QR+U1EYHLjJYy5BalMn+hl+NtzPSpQMrihS1I11A=; h=Date:From:To:Subject:From; b=YzbtMV0X8/6D4Fz0nDvTu9PucPDycFV3GEhx7dKkej3r/YOON4X0P2fU2NtQT1W8/ QLNURAUCbjcR2Iz4r1EoksYOzWqePhpue5j8ktpM7osfDGgatcDdQfaSIRu0EIClvu UbjRJTdxN0XFcyZfCkAb1GRvDsf+yr9ZMuL513XY= Date: Sun, 09 May 2021 20:54:35 -0700 From: akpm@linux-foundation.org To: almasrymina@google.com, anshuman.khandual@arm.com, bodeddub@amazon.com, bp@alien8.de, bsingharora@gmail.com, chenhuang5@huawei.com, corbet@lwn.net, dave.hansen@linux.intel.com, david@redhat.com, duanxiongchun@bytedance.com, hpa@zytor.com, joao.m.martins@oracle.com, jroedel@suse.de, linmiaohe@huawei.com, luto@kernel.org, mhocko@suse.com, mike.kravetz@oracle.com, mingo@redhat.com, mm-commits@vger.kernel.org, naoya.horiguchi@nec.com, oneukum@suse.com, osalvador@suse.de, paulmck@kernel.org, pawan.kumar.gupta@linux.intel.com, peterz@infradead.org, rdunlap@infradead.org, rientjes@google.com, song.bao.hua@hisilicon.com, songmuchun@bytedance.com, tglx@linutronix.de, viro@zeniv.linux.org.uk, willy@infradead.org Subject: + mm-hugetlb-introduce-a-new-config-hugetlb_page_free_vmemmap.patch added to -mm tree Message-ID: <20210510035435.o10nVmQLY%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The patch titled Subject: mm: hugetlb: introduce a new config HUGETLB_PAGE_FREE_VMEMMAP has been added to the -mm tree. Its filename is mm-hugetlb-introduce-a-new-config-hugetlb_page_free_vmemmap.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-hugetlb-introduce-a-new-config-hugetlb_page_free_vmemmap.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-hugetlb-introduce-a-new-config-hugetlb_page_free_vmemmap.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Muchun Song Subject: mm: hugetlb: introduce a new config HUGETLB_PAGE_FREE_VMEMMAP 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. 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. If config HAVE_BOOTMEM_INFO_NODE is enabled, the freeing vmemmap page code denpend on it to free vmemmap pages. Otherwise, just use free_reserved_page() to free vmemmmap pages. 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. Link: https://lkml.kernel.org/r/20210510030027.56044-3-songmuchun@bytedance.com Signed-off-by: Muchun Song Reviewed-by: Oscar Salvador Acked-by: Mike Kravetz Reviewed-by: Miaohe Lin Tested-by: Chen Huang Tested-by: Bodeddula Balasubramaniam Reviewed-by: Balbir Singh Cc: Alexander Viro Cc: Andy Lutomirski Cc: Anshuman Khandual Cc: Barry Song Cc: Borislav Petkov Cc: Dave Hansen Cc: David Hildenbrand Cc: David Rientjes Cc: HORIGUCHI NAOYA Cc: "H. Peter Anvin" Cc: Ingo Molnar Cc: Joao Martins Cc: Joerg Roedel Cc: Jonathan Corbet Cc: Matthew Wilcox Cc: Michal Hocko Cc: Mina Almasry Cc: Oliver Neukum Cc: Paul E. McKenney Cc: Pawan Gupta Cc: Peter Zijlstra Cc: Randy Dunlap Cc: Thomas Gleixner Cc: Xiongchun Duan Signed-off-by: Andrew Morton --- arch/x86/mm/init_64.c | 2 +- fs/Kconfig | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) --- a/arch/x86/mm/init_64.c~mm-hugetlb-introduce-a-new-config-hugetlb_page_free_vmemmap +++ a/arch/x86/mm/init_64.c @@ -1270,7 +1270,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) --- a/fs/Kconfig~mm-hugetlb-introduce-a-new-config-hugetlb_page_free_vmemmap +++ a/fs/Kconfig @@ -240,6 +240,11 @@ 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 + config MEMFD_CREATE def_bool TMPFS || HUGETLBFS _ Patches currently in -mm which might be from songmuchun@bytedance.com are mm-memcontrol-fix-root_mem_cgroup-charging.patch mm-memory_hotplug-factor-out-bootmem-core-functions-to-bootmem_infoc.patch mm-hugetlb-introduce-a-new-config-hugetlb_page_free_vmemmap.patch mm-hugetlb-gather-discrete-indexes-of-tail-page.patch mm-hugetlb-free-the-vmemmap-pages-associated-with-each-hugetlb-page.patch mm-hugetlb-defer-freeing-of-hugetlb-pages.patch mm-hugetlb-alloc-the-vmemmap-pages-associated-with-each-hugetlb-page.patch mm-hugetlb-add-a-kernel-parameter-hugetlb_free_vmemmap.patch mm-memory_hotplug-disable-memmap_on_memory-when-hugetlb_free_vmemmap-enabled.patch mm-hugetlb-introduce-nr_free_vmemmap_pages-in-the-struct-hstate.patch