Skip to content

Commit

Permalink
memory cgroup enhancements: implicit force_empty() at rmdir
Browse files Browse the repository at this point in the history
Add pre_destroy handler for mem_cgroup and try to make mem_cgroup empty at
rmdir().

Signed-off-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: "Eric W. Biederman" <[email protected]>
Cc: Balbir Singh <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Herbert Poetzl <[email protected]>
Cc: Kirill Korotaev <[email protected]>
Cc: Nick Piggin <[email protected]>
Cc: Paul Menage <[email protected]>
Cc: Pavel Emelianov <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Vaidyanathan Srinivasan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
hkamezawa authored and Linus Torvalds committed Feb 7, 2008
1 parent 4fca88c commit df878fb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,13 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
return &mem->css;
}

static void mem_cgroup_pre_destroy(struct cgroup_subsys *ss,
struct cgroup *cont)
{
struct mem_cgroup *mem = mem_cgroup_from_cont(cont);
mem_cgroup_force_empty(mem);
}

static void mem_cgroup_destroy(struct cgroup_subsys *ss,
struct cgroup *cont)
{
Expand Down Expand Up @@ -946,6 +953,7 @@ struct cgroup_subsys mem_cgroup_subsys = {
.name = "memory",
.subsys_id = mem_cgroup_subsys_id,
.create = mem_cgroup_create,
.pre_destroy = mem_cgroup_pre_destroy,
.destroy = mem_cgroup_destroy,
.populate = mem_cgroup_populate,
.attach = mem_cgroup_move_task,
Expand Down

0 comments on commit df878fb

Please sign in to comment.