diff options
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9715c0c491b0..df87bdd4d692 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -5814,6 +5814,7 @@ static struct cftype mem_cgroup_files[] = { | |||
5814 | }, | 5814 | }, |
5815 | { | 5815 | { |
5816 | .name = "use_hierarchy", | 5816 | .name = "use_hierarchy", |
5817 | .flags = CFTYPE_INSANE, | ||
5817 | .write_u64 = mem_cgroup_hierarchy_write, | 5818 | .write_u64 = mem_cgroup_hierarchy_write, |
5818 | .read_u64 = mem_cgroup_hierarchy_read, | 5819 | .read_u64 = mem_cgroup_hierarchy_read, |
5819 | }, | 5820 | }, |
@@ -6784,6 +6785,21 @@ static void mem_cgroup_move_task(struct cgroup *cont, | |||
6784 | } | 6785 | } |
6785 | #endif | 6786 | #endif |
6786 | 6787 | ||
6788 | /* | ||
6789 | * Cgroup retains root cgroups across [un]mount cycles making it necessary | ||
6790 | * to verify sane_behavior flag on each mount attempt. | ||
6791 | */ | ||
6792 | static void mem_cgroup_bind(struct cgroup *root) | ||
6793 | { | ||
6794 | /* | ||
6795 | * use_hierarchy is forced with sane_behavior. cgroup core | ||
6796 | * guarantees that @root doesn't have any children, so turning it | ||
6797 | * on for the root memcg is enough. | ||
6798 | */ | ||
6799 | if (cgroup_sane_behavior(root)) | ||
6800 | mem_cgroup_from_cont(root)->use_hierarchy = true; | ||
6801 | } | ||
6802 | |||
6787 | struct cgroup_subsys mem_cgroup_subsys = { | 6803 | struct cgroup_subsys mem_cgroup_subsys = { |
6788 | .name = "memory", | 6804 | .name = "memory", |
6789 | .subsys_id = mem_cgroup_subsys_id, | 6805 | .subsys_id = mem_cgroup_subsys_id, |
@@ -6794,6 +6810,7 @@ struct cgroup_subsys mem_cgroup_subsys = { | |||
6794 | .can_attach = mem_cgroup_can_attach, | 6810 | .can_attach = mem_cgroup_can_attach, |
6795 | .cancel_attach = mem_cgroup_cancel_attach, | 6811 | .cancel_attach = mem_cgroup_cancel_attach, |
6796 | .attach = mem_cgroup_move_task, | 6812 | .attach = mem_cgroup_move_task, |
6813 | .bind = mem_cgroup_bind, | ||
6797 | .base_cftypes = mem_cgroup_files, | 6814 | .base_cftypes = mem_cgroup_files, |
6798 | .early_init = 0, | 6815 | .early_init = 0, |
6799 | .use_id = 1, | 6816 | .use_id = 1, |