path: root/mm/Kconfig
diff options
authorHugh Dickins <>2009-09-21 17:01:57 -0700
committerLinus Torvalds <>2009-09-22 07:17:31 -0700
commitf8af4da3b4c14e7267c4ffb952079af3912c51c5 (patch)
tree17b0cfbd2d3d9abf9008f69e7fee5369cec7afa5 /mm/Kconfig
parentd19f352484467a5e518639ddff0554669c10ffab (diff)
ksm: the mm interface to ksm
This patch presents the mm interface to a dummy version of ksm.c, for better scrutiny of that interface: the real ksm.c follows later. When CONFIG_KSM is not set, madvise(2) reject MADV_MERGEABLE and MADV_UNMERGEABLE with EINVAL, since that seems more helpful than pretending that they can be serviced. But when CONFIG_KSM=y, accept them even if KSM is not currently running, and even on areas which KSM will not touch (e.g. hugetlb or shared file or special driver mappings). Like other madvices, report ENOMEM despite success if any area in the range is unmapped, and use EAGAIN to report out of memory. Define vma flag VM_MERGEABLE to identify an area on which KSM may try merging pages: leave it to ksm_madvise() to decide whether to set it. Define mm flag MMF_VM_MERGEABLE to identify an mm which might contain VM_MERGEABLE areas, to minimize callouts when forking or exiting. Based upon earlier patches by Chris Wright and Izik Eidus. Signed-off-by: Hugh Dickins <> Signed-off-by: Chris Wright <> Signed-off-by: Izik Eidus <> Cc: Michael Kerrisk <> Cc: Andrea Arcangeli <> Cc: Rik van Riel <> Cc: Wu Fengguang <> Cc: Balbir Singh <> Cc: Hugh Dickins <> Cc: KAMEZAWA Hiroyuki <> Cc: Lee Schermerhorn <> Cc: Avi Kivity <> Cc: Nick Piggin <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/Kconfig')
1 files changed, 11 insertions, 0 deletions
diff --git a/mm/Kconfig b/mm/Kconfig
index 3aa519f52e1..c0b6afa178a 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -214,6 +214,17 @@ config HAVE_MLOCKED_PAGE_BIT
+config KSM
+ bool "Enable KSM for page merging"
+ depends on MMU
+ help
+ Enable Kernel Samepage Merging: KSM periodically scans those areas
+ of an application's address space that an app has advised may be
+ mergeable. When it finds pages of identical content, it replaces
+ the many instances by a single resident page with that content, so
+ saving memory until one or another app needs to modify the content.
+ Recommended for use with KVM, or with other duplicative applications.
int "Low address space to protect from user allocation"
default 4096