Skip to content

Commit cba5d9b

Browse files
kirylIngo Molnar
authored andcommitted
x86/mm/64: Make SPARSEMEM_VMEMMAP the only memory model
5-level paging only supports SPARSEMEM_VMEMMAP. CONFIG_X86_5LEVEL is being phased out, making 5-level paging support mandatory. Make CONFIG_SPARSEMEM_VMEMMAP mandatory for x86-64 and eliminate any associated conditional statements. Signed-off-by: Kirill A. Shutemov <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Reviewed-by: Ard Biesheuvel <[email protected]> Reviewed-by: Borislav Petkov (AMD) <[email protected]> Cc: Dave Hansen <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Linus Torvalds <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 1bffe6f commit cba5d9b

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

arch/x86/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,6 @@ config X86_PAE
14671467
config X86_5LEVEL
14681468
bool "Enable 5-level page tables support"
14691469
default y
1470-
select SPARSEMEM_VMEMMAP
14711470
depends on X86_64
14721471
help
14731472
5-level paging enables access to larger address space:
@@ -1579,6 +1578,7 @@ config ARCH_SPARSEMEM_ENABLE
15791578
def_bool y
15801579
select SPARSEMEM_STATIC if X86_32
15811580
select SPARSEMEM_VMEMMAP_ENABLE if X86_64
1581+
select SPARSEMEM_VMEMMAP if X86_64
15821582

15831583
config ARCH_SPARSEMEM_DEFAULT
15841584
def_bool X86_64 || (NUMA && X86_32)

arch/x86/mm/init_64.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,6 @@ void __init paging_init(void)
833833
zone_sizes_init();
834834
}
835835

836-
#ifdef CONFIG_SPARSEMEM_VMEMMAP
837836
#define PAGE_UNUSED 0xFD
838837

839838
/*
@@ -932,7 +931,6 @@ static void __meminit vmemmap_use_new_sub_pmd(unsigned long start, unsigned long
932931
if (!IS_ALIGNED(end, PMD_SIZE))
933932
unused_pmd_start = end;
934933
}
935-
#endif
936934

937935
/*
938936
* Memory hotplug specific functions
@@ -1152,16 +1150,13 @@ remove_pmd_table(pmd_t *pmd_start, unsigned long addr, unsigned long end,
11521150
pmd_clear(pmd);
11531151
spin_unlock(&init_mm.page_table_lock);
11541152
pages++;
1155-
}
1156-
#ifdef CONFIG_SPARSEMEM_VMEMMAP
1157-
else if (vmemmap_pmd_is_unused(addr, next)) {
1153+
} else if (vmemmap_pmd_is_unused(addr, next)) {
11581154
free_hugepage_table(pmd_page(*pmd),
11591155
altmap);
11601156
spin_lock(&init_mm.page_table_lock);
11611157
pmd_clear(pmd);
11621158
spin_unlock(&init_mm.page_table_lock);
11631159
}
1164-
#endif
11651160
continue;
11661161
}
11671162

@@ -1500,7 +1495,6 @@ unsigned long memory_block_size_bytes(void)
15001495
return memory_block_size_probed;
15011496
}
15021497

1503-
#ifdef CONFIG_SPARSEMEM_VMEMMAP
15041498
/*
15051499
* Initialise the sparsemem vmemmap using huge-pages at the PMD level.
15061500
*/
@@ -1647,4 +1641,3 @@ void __meminit vmemmap_populate_print_last(void)
16471641
node_start = 0;
16481642
}
16491643
}
1650-
#endif

0 commit comments

Comments
 (0)