[PATCH v2 06/46] hugetlb: add CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING
From: James Houghton
Date: Fri Feb 17 2023 - 19:29:07 EST
This adds the Kconfig to enable or disable high-granularity mapping.
Each architecture must explicitly opt-in to it (via
ARCH_WANT_HUGETLB_HIGH_GRANULARITY_MAPPING), but when opted in, HGM will
be enabled by default if HUGETLB_PAGE is enabled.
Signed-off-by: James Houghton <jthoughton@xxxxxxxxxx>
diff --git a/fs/Kconfig b/fs/Kconfig
index 2685a4d0d353..a072bbe3439a 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -246,6 +246,18 @@ config HUGETLBFS
config HUGETLB_PAGE
def_bool HUGETLBFS
+config ARCH_WANT_HUGETLB_HIGH_GRANULARITY_MAPPING
+ bool
+
+config HUGETLB_HIGH_GRANULARITY_MAPPING
+ bool "HugeTLB high-granularity mapping support"
+ default n
+ depends on ARCH_WANT_HUGETLB_HIGH_GRANULARITY_MAPPING
+ help
+ HugeTLB high-granularity mapping (HGM) allows userspace to issue
+ UFFDIO_CONTINUE on HugeTLB mappings in PAGE_SIZE chunks.
+ HGM is incompatible with the HugeTLB Vmemmap Optimization (HVO).
+
#
# Select this config option from the architecture Kconfig, if it is preferred
# to enable the feature of HugeTLB Vmemmap Optimization (HVO).
@@ -257,6 +269,7 @@ config HUGETLB_PAGE_OPTIMIZE_VMEMMAP
def_bool HUGETLB_PAGE
depends on ARCH_WANT_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
depends on SPARSEMEM_VMEMMAP
+ depends on !HUGETLB_HIGH_GRANULARITY_MAPPING
config HUGETLB_PAGE_OPTIMIZE_VMEMMAP_DEFAULT_ON
bool "HugeTLB Vmemmap Optimization (HVO) defaults to on"
--
2.39.2.637.g21b0678d19-goog