|
@@ -49,6 +49,7 @@
|
|
#include <linux/ftrace.h>
|
|
#include <linux/ftrace.h>
|
|
#include <linux/profile.h>
|
|
#include <linux/profile.h>
|
|
#include <linux/rmap.h>
|
|
#include <linux/rmap.h>
|
|
|
|
+#include <linux/ksm.h>
|
|
#include <linux/acct.h>
|
|
#include <linux/acct.h>
|
|
#include <linux/tsacct_kern.h>
|
|
#include <linux/tsacct_kern.h>
|
|
#include <linux/cn_proc.h>
|
|
#include <linux/cn_proc.h>
|
|
@@ -299,6 +300,9 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
|
|
rb_link = &mm->mm_rb.rb_node;
|
|
rb_link = &mm->mm_rb.rb_node;
|
|
rb_parent = NULL;
|
|
rb_parent = NULL;
|
|
pprev = &mm->mmap;
|
|
pprev = &mm->mmap;
|
|
|
|
+ retval = ksm_fork(mm, oldmm);
|
|
|
|
+ if (retval)
|
|
|
|
+ goto out;
|
|
|
|
|
|
for (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) {
|
|
for (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) {
|
|
struct file *file;
|
|
struct file *file;
|
|
@@ -435,7 +439,8 @@ static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)
|
|
atomic_set(&mm->mm_count, 1);
|
|
atomic_set(&mm->mm_count, 1);
|
|
init_rwsem(&mm->mmap_sem);
|
|
init_rwsem(&mm->mmap_sem);
|
|
INIT_LIST_HEAD(&mm->mmlist);
|
|
INIT_LIST_HEAD(&mm->mmlist);
|
|
- mm->flags = (current->mm) ? current->mm->flags : default_dump_filter;
|
|
|
|
|
|
+ mm->flags = (current->mm) ?
|
|
|
|
+ (current->mm->flags & MMF_INIT_MASK) : default_dump_filter;
|
|
mm->core_state = NULL;
|
|
mm->core_state = NULL;
|
|
mm->nr_ptes = 0;
|
|
mm->nr_ptes = 0;
|
|
set_mm_counter(mm, file_rss, 0);
|
|
set_mm_counter(mm, file_rss, 0);
|
|
@@ -496,6 +501,7 @@ void mmput(struct mm_struct *mm)
|
|
|
|
|
|
if (atomic_dec_and_test(&mm->mm_users)) {
|
|
if (atomic_dec_and_test(&mm->mm_users)) {
|
|
exit_aio(mm);
|
|
exit_aio(mm);
|
|
|
|
+ ksm_exit(mm);
|
|
exit_mmap(mm);
|
|
exit_mmap(mm);
|
|
set_mm_exe_file(mm, NULL);
|
|
set_mm_exe_file(mm, NULL);
|
|
if (!list_empty(&mm->mmlist)) {
|
|
if (!list_empty(&mm->mmlist)) {
|