diff mbox series

[v2,06/46] hugetlb: add CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING

Message ID 20230218002819.1486479-7-jthoughton@google.com (mailing list archive)
State New
Headers show
Series hugetlb: introduce HugeTLB high-granularity mapping | expand

Commit Message

James Houghton Feb. 18, 2023, 12:27 a.m. UTC
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@google.com>
diff mbox series

Patch

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"