diff options
Diffstat (limited to 'kernel/fork.c')
-rw-r--r-- | kernel/fork.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index d4638c8cc19e..73a442b7be6d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/ftrace.h> | 49 | #include <linux/ftrace.h> |
50 | #include <linux/profile.h> | 50 | #include <linux/profile.h> |
51 | #include <linux/rmap.h> | 51 | #include <linux/rmap.h> |
52 | #include <linux/ksm.h> | ||
52 | #include <linux/acct.h> | 53 | #include <linux/acct.h> |
53 | #include <linux/tsacct_kern.h> | 54 | #include <linux/tsacct_kern.h> |
54 | #include <linux/cn_proc.h> | 55 | #include <linux/cn_proc.h> |
@@ -299,6 +300,9 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) | |||
299 | rb_link = &mm->mm_rb.rb_node; | 300 | rb_link = &mm->mm_rb.rb_node; |
300 | rb_parent = NULL; | 301 | rb_parent = NULL; |
301 | pprev = &mm->mmap; | 302 | pprev = &mm->mmap; |
303 | retval = ksm_fork(mm, oldmm); | ||
304 | if (retval) | ||
305 | goto out; | ||
302 | 306 | ||
303 | for (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) { | 307 | for (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) { |
304 | struct file *file; | 308 | struct file *file; |
@@ -435,7 +439,8 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p) | |||
435 | atomic_set(&mm->mm_count, 1); | 439 | atomic_set(&mm->mm_count, 1); |
436 | init_rwsem(&mm->mmap_sem); | 440 | init_rwsem(&mm->mmap_sem); |
437 | INIT_LIST_HEAD(&mm->mmlist); | 441 | INIT_LIST_HEAD(&mm->mmlist); |
438 | mm->flags = (current->mm) ? current->mm->flags : default_dump_filter; | 442 | mm->flags = (current->mm) ? |
443 | (current->mm->flags & MMF_INIT_MASK) : default_dump_filter; | ||
439 | mm->core_state = NULL; | 444 | mm->core_state = NULL; |
440 | mm->nr_ptes = 0; | 445 | mm->nr_ptes = 0; |
441 | set_mm_counter(mm, file_rss, 0); | 446 | set_mm_counter(mm, file_rss, 0); |
@@ -496,6 +501,7 @@ void mmput(struct mm_struct *mm) | |||
496 | 501 | ||
497 | if (atomic_dec_and_test(&mm->mm_users)) { | 502 | if (atomic_dec_and_test(&mm->mm_users)) { |
498 | exit_aio(mm); | 503 | exit_aio(mm); |
504 | ksm_exit(mm); | ||
499 | exit_mmap(mm); | 505 | exit_mmap(mm); |
500 | set_mm_exe_file(mm, NULL); | 506 | set_mm_exe_file(mm, NULL); |
501 | if (!list_empty(&mm->mmlist)) { | 507 | if (!list_empty(&mm->mmlist)) { |