aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins <hugh.dickins@tiscali.co.uk>2009-09-21 20:01:53 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-22 10:17:31 -0400
commitd19f352484467a5e518639ddff0554669c10ffab (patch)
tree87c31fff63fd3dccb2e47ddfee878a11228b7777
parent3866ea90d3635ddddcd77ce51087222ac7de85f2 (diff)
ksm: define MADV_MERGEABLE and MADV_UNMERGEABLE
The out-of-tree KSM used ioctls on fds cloned from /dev/ksm to register a memory area for merging: we prefer now to use an madvise(2) interface. This patch just defines MADV_MERGEABLE (to tell KSM it may merge pages in this area found identical to pages in other mergeable areas) and MADV_UNMERGEABLE (to undo that). Most architectures use asm-generic, but alpha, mips, parisc, xtensa need their own definitions: included here for mmotm convenience, but we'll probably want to split this and feed pieces to arch maintainers. Based upon earlier patches by Chris Wright and Izik Eidus. Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Signed-off-by: Chris Wright <chrisw@redhat.com> Signed-off-by: Izik Eidus <ieidus@redhat.com> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Cc: Richard Henderson <rth@twiddle.net> Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Kyle McMartin <kyle@mcmartin.ca> Cc: Helge Deller <deller@gmx.de> Cc: Chris Zankel <chris@zankel.net> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Wu Fengguang <fengguang.wu@intel.com> Cc: Balbir Singh <balbir@in.ibm.com> Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Lee Schermerhorn <lee.schermerhorn@hp.com> Cc: Avi Kivity <avi@redhat.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/alpha/include/asm/mman.h3
-rw-r--r--arch/mips/include/asm/mman.h3
-rw-r--r--arch/parisc/include/asm/mman.h3
-rw-r--r--arch/xtensa/include/asm/mman.h3
-rw-r--r--include/asm-generic/mman-common.h3
5 files changed, 15 insertions, 0 deletions
diff --git a/arch/alpha/include/asm/mman.h b/arch/alpha/include/asm/mman.h
index 90d7c35d2867..c77c55756a7c 100644
--- a/arch/alpha/include/asm/mman.h
+++ b/arch/alpha/include/asm/mman.h
@@ -48,6 +48,9 @@
48#define MADV_DONTFORK 10 /* don't inherit across fork */ 48#define MADV_DONTFORK 10 /* don't inherit across fork */
49#define MADV_DOFORK 11 /* do inherit across fork */ 49#define MADV_DOFORK 11 /* do inherit across fork */
50 50
51#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
52#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
53
51/* compatibility flags */ 54/* compatibility flags */
52#define MAP_FILE 0 55#define MAP_FILE 0
53 56
diff --git a/arch/mips/include/asm/mman.h b/arch/mips/include/asm/mman.h
index e4d6f1fb1cf7..f15554d1518a 100644
--- a/arch/mips/include/asm/mman.h
+++ b/arch/mips/include/asm/mman.h
@@ -71,6 +71,9 @@
71#define MADV_DONTFORK 10 /* don't inherit across fork */ 71#define MADV_DONTFORK 10 /* don't inherit across fork */
72#define MADV_DOFORK 11 /* do inherit across fork */ 72#define MADV_DOFORK 11 /* do inherit across fork */
73 73
74#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
75#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
76
74/* compatibility flags */ 77/* compatibility flags */
75#define MAP_FILE 0 78#define MAP_FILE 0
76 79
diff --git a/arch/parisc/include/asm/mman.h b/arch/parisc/include/asm/mman.h
index defe752cc996..a12d9d43f507 100644
--- a/arch/parisc/include/asm/mman.h
+++ b/arch/parisc/include/asm/mman.h
@@ -54,6 +54,9 @@
54#define MADV_16M_PAGES 24 /* Use 16 Megabyte pages */ 54#define MADV_16M_PAGES 24 /* Use 16 Megabyte pages */
55#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */ 55#define MADV_64M_PAGES 26 /* Use 64 Megabyte pages */
56 56
57#define MADV_MERGEABLE 65 /* KSM may merge identical pages */
58#define MADV_UNMERGEABLE 66 /* KSM may not merge identical pages */
59
57/* compatibility flags */ 60/* compatibility flags */
58#define MAP_FILE 0 61#define MAP_FILE 0
59#define MAP_VARIABLE 0 62#define MAP_VARIABLE 0
diff --git a/arch/xtensa/include/asm/mman.h b/arch/xtensa/include/asm/mman.h
index 9b92620c8a1e..6e55b4d1f9c5 100644
--- a/arch/xtensa/include/asm/mman.h
+++ b/arch/xtensa/include/asm/mman.h
@@ -78,6 +78,9 @@
78#define MADV_DONTFORK 10 /* don't inherit across fork */ 78#define MADV_DONTFORK 10 /* don't inherit across fork */
79#define MADV_DOFORK 11 /* do inherit across fork */ 79#define MADV_DOFORK 11 /* do inherit across fork */
80 80
81#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
82#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
83
81/* compatibility flags */ 84/* compatibility flags */
82#define MAP_FILE 0 85#define MAP_FILE 0
83 86
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h
index 3b69ad34189a..dd63bd38864b 100644
--- a/include/asm-generic/mman-common.h
+++ b/include/asm-generic/mman-common.h
@@ -35,6 +35,9 @@
35#define MADV_DONTFORK 10 /* don't inherit across fork */ 35#define MADV_DONTFORK 10 /* don't inherit across fork */
36#define MADV_DOFORK 11 /* do inherit across fork */ 36#define MADV_DOFORK 11 /* do inherit across fork */
37 37
38#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
39#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
40
38/* compatibility flags */ 41/* compatibility flags */
39#define MAP_FILE 0 42#define MAP_FILE 0
40 43