aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memcontrol.c
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2008-02-07 03:14:28 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-07 11:42:20 -0500
commitdf878fb04dea044378274d40d063279a9cb787fb (patch)
treeba2246475af5c84b9968182b6b8212348671ddef /mm/memcontrol.c
parent4fca88c87b7969c698912e2de9b1b31088c777cb (diff)
memory cgroup enhancements: implicit force_empty() at rmdir
Add pre_destroy handler for mem_cgroup and try to make mem_cgroup empty at rmdir(). Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Cc: David Rientjes <rientjes@google.com> Cc: Herbert Poetzl <herbert@13thfloor.at> Cc: Kirill Korotaev <dev@sw.ru> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: Paul Menage <menage@google.com> Cc: Pavel Emelianov <xemul@openvz.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r--mm/memcontrol.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 904e9a9c223d..14cb6142ec4c 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -895,6 +895,13 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
895 return &mem->css; 895 return &mem->css;
896} 896}
897 897
898static void mem_cgroup_pre_destroy(struct cgroup_subsys *ss,
899 struct cgroup *cont)
900{
901 struct mem_cgroup *mem = mem_cgroup_from_cont(cont);
902 mem_cgroup_force_empty(mem);
903}
904
898static void mem_cgroup_destroy(struct cgroup_subsys *ss, 905static void mem_cgroup_destroy(struct cgroup_subsys *ss,
899 struct cgroup *cont) 906 struct cgroup *cont)
900{ 907{
@@ -946,6 +953,7 @@ struct cgroup_subsys mem_cgroup_subsys = {
946 .name = "memory", 953 .name = "memory",
947 .subsys_id = mem_cgroup_subsys_id, 954 .subsys_id = mem_cgroup_subsys_id,
948 .create = mem_cgroup_create, 955 .create = mem_cgroup_create,
956 .pre_destroy = mem_cgroup_pre_destroy,
949 .destroy = mem_cgroup_destroy, 957 .destroy = mem_cgroup_destroy,
950 .populate = mem_cgroup_populate, 958 .populate = mem_cgroup_populate,
951 .attach = mem_cgroup_move_task, 959 .attach = mem_cgroup_move_task,