@@ -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,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