Memory controller: accounting setup
Basic setup routines, the mm_struct has a pointer to the cgroup that it belongs to and the the page has a page_cgroup associated with it. Signed-off-by: Pavel Emelianov <xemul@openvz.org> Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: Paul Menage <menage@google.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Kirill Korotaev <dev@sw.ru> Cc: Herbert Poetzl <herbert@13thfloor.at> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
8cdea7c054
commit
78fb74669e
@ -40,6 +40,7 @@
|
||||
#include <linux/ptrace.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/audit.h>
|
||||
#include <linux/memcontrol.h>
|
||||
#include <linux/profile.h>
|
||||
#include <linux/rmap.h>
|
||||
#include <linux/acct.h>
|
||||
@ -340,7 +341,7 @@ __cacheline_aligned_in_smp DEFINE_SPINLOCK(mmlist_lock);
|
||||
|
||||
#include <linux/init_task.h>
|
||||
|
||||
static struct mm_struct * mm_init(struct mm_struct * mm)
|
||||
static struct mm_struct * mm_init(struct mm_struct * mm, struct task_struct *p)
|
||||
{
|
||||
atomic_set(&mm->mm_users, 1);
|
||||
atomic_set(&mm->mm_count, 1);
|
||||
@ -357,11 +358,14 @@ static struct mm_struct * mm_init(struct mm_struct * mm)
|
||||
mm->ioctx_list = NULL;
|
||||
mm->free_area_cache = TASK_UNMAPPED_BASE;
|
||||
mm->cached_hole_size = ~0UL;
|
||||
mm_init_cgroup(mm, p);
|
||||
|
||||
if (likely(!mm_alloc_pgd(mm))) {
|
||||
mm->def_flags = 0;
|
||||
return mm;
|
||||
}
|
||||
|
||||
mm_free_cgroup(mm);
|
||||
free_mm(mm);
|
||||
return NULL;
|
||||
}
|
||||
@ -376,7 +380,7 @@ struct mm_struct * mm_alloc(void)
|
||||
mm = allocate_mm();
|
||||
if (mm) {
|
||||
memset(mm, 0, sizeof(*mm));
|
||||
mm = mm_init(mm);
|
||||
mm = mm_init(mm, current);
|
||||
}
|
||||
return mm;
|
||||
}
|
||||
@ -390,6 +394,7 @@ void fastcall __mmdrop(struct mm_struct *mm)
|
||||
{
|
||||
BUG_ON(mm == &init_mm);
|
||||
mm_free_pgd(mm);
|
||||
mm_free_cgroup(mm);
|
||||
destroy_context(mm);
|
||||
free_mm(mm);
|
||||
}
|
||||
@ -511,7 +516,7 @@ static struct mm_struct *dup_mm(struct task_struct *tsk)
|
||||
mm->token_priority = 0;
|
||||
mm->last_interval = 0;
|
||||
|
||||
if (!mm_init(mm))
|
||||
if (!mm_init(mm, tsk))
|
||||
goto fail_nomem;
|
||||
|
||||
if (init_new_context(tsk, mm))
|
||||
|
Reference in New Issue
Block a user