@@ -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)
@@ -245,6 +245,20 @@ config HUGETLBFS
config HUGETLB_PAGE
def_bool HUGETLBFS
+config HUGETLB_PAGE_FREE_VMEMMAP
+ def_bool HUGETLB_PAGE
+ depends on X86
+ depends on SPARSEMEM_VMEMMAP
+ depends on HAVE_BOOTMEM_INFO_NODE
+ help
+ When using HUGETLB_PAGE_FREE_VMEMMAP, the system can save up some
+ memory from pre-allocated HugeTLB pages when they are not used.
+ 6 pages per 2MB HugeTLB page and 4094 per 1GB HugeTLB page.
+
+ When the pages are going to be used or freed up, the vmemmap array
+ representing that range needs to be remapped again and the pages
+ we discarded earlier need to be rellocated again.
+
config MEMFD_CREATE
def_bool TMPFS || HUGETLBFS
The purpose of introducing HUGETLB_PAGE_FREE_VMEMMAP is to configure whether to enable the feature of freeing unused vmemmap associated with HugeTLB pages. And this is just for dependency check. Now only support x86. Signed-off-by: Muchun Song <songmuchun@bytedance.com> --- arch/x86/mm/init_64.c | 2 +- fs/Kconfig | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)