diff mbox series

[RFC,1/6] mm: introduce SELECTIVE_KSM KConfig

Message ID 20250321173729.3175898-2-souravpanda@google.com (mailing list archive)
State New
Headers show
Series Selective KSM: Synchronous and Partitioned Merging | expand

Commit Message

Sourav Panda March 21, 2025, 5:37 p.m. UTC
Gate the partitioned and synchronous features of SELECTIVE_KSM behind
a KConfig. This shall prevent vanilla KSM's background thread from
stepping over SELECTIVE_KSM.

Signed-off-by: Sourav Panda <souravpanda@google.com>
---
 mm/Kconfig | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/mm/Kconfig b/mm/Kconfig
index 1b501db06417..f9873002414c 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -783,6 +783,17 @@  config KSM
 	  until a program has madvised that an area is MADV_MERGEABLE, and
 	  root has set /sys/kernel/mm/ksm/run to 1 (if CONFIG_SYSFS is set).
 
+config SELECTIVE_KSM
+	bool "Enable Selective KSM for page merging"
+	depends on KSM
+	help
+	  Enable Synchronous and Partitioned KSM for page merging. There is
+	  no background scanning. Instead, userspace specifies the pid
+	  and address range to have merged. The partitioning aspect divides
+	  the merge space into security domains. Merging of pages only takes
+	  place within a partition, improving security. Furthermore, trees
+	  in each partitioning becomes smaller, improving CPU efficiency.
+
 config DEFAULT_MMAP_MIN_ADDR
 	int "Low address space to protect from user allocation"
 	depends on MMU