aboutsummaryrefslogtreecommitdiffstats
path: root/mm/madvise.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/madvise.c')
-rw-r--r--mm/madvise.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/mm/madvise.c b/mm/madvise.c
index 66c31264f062..d9ae2067952e 100644
--- a/mm/madvise.c
+++ b/mm/madvise.c
@@ -11,6 +11,7 @@
11#include <linux/mempolicy.h> 11#include <linux/mempolicy.h>
12#include <linux/hugetlb.h> 12#include <linux/hugetlb.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/ksm.h>
14 15
15/* 16/*
16 * Any behaviour which results in changes to the vma->vm_flags needs to 17 * Any behaviour which results in changes to the vma->vm_flags needs to
@@ -63,6 +64,12 @@ static long madvise_behavior(struct vm_area_struct * vma,
63 } 64 }
64 new_flags &= ~VM_DONTCOPY; 65 new_flags &= ~VM_DONTCOPY;
65 break; 66 break;
67 case MADV_MERGEABLE:
68 case MADV_UNMERGEABLE:
69 error = ksm_madvise(vma, start, end, behavior, &new_flags);
70 if (error)
71 goto out;
72 break;
66 } 73 }
67 74
68 if (new_flags == vma->vm_flags) { 75 if (new_flags == vma->vm_flags) {
@@ -239,6 +246,10 @@ madvise_behavior_valid(int behavior)
239 case MADV_REMOVE: 246 case MADV_REMOVE:
240 case MADV_WILLNEED: 247 case MADV_WILLNEED:
241 case MADV_DONTNEED: 248 case MADV_DONTNEED:
249#ifdef CONFIG_KSM
250 case MADV_MERGEABLE:
251 case MADV_UNMERGEABLE:
252#endif
242 return 1; 253 return 1;
243 254
244 default: 255 default:
@@ -273,6 +284,9 @@ madvise_behavior_valid(int behavior)
273 * MADV_DONTFORK - omit this area from child's address space when forking: 284 * MADV_DONTFORK - omit this area from child's address space when forking:
274 * typically, to avoid COWing pages pinned by get_user_pages(). 285 * typically, to avoid COWing pages pinned by get_user_pages().
275 * MADV_DOFORK - cancel MADV_DONTFORK: no longer omit this area when forking. 286 * MADV_DOFORK - cancel MADV_DONTFORK: no longer omit this area when forking.
287 * MADV_MERGEABLE - the application recommends that KSM try to merge pages in
288 * this area with pages of identical content from other such areas.
289 * MADV_UNMERGEABLE- cancel MADV_MERGEABLE: no longer merge pages with others.
276 * 290 *
277 * return values: 291 * return values:
278 * zero - success 292 * zero - success