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

Sourav Panda posted 6 patches 10 months, 3 weeks ago
[RFC PATCH 1/6] mm: introduce SELECTIVE_KSM KConfig
Posted by Sourav Panda 10 months, 3 weeks ago
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 --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
-- 
2.49.0.395.g12beb8f557-goog