diff options
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index c57c4423c688..b732edfddb76 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -434,7 +434,7 @@ struct cgroup_subsys_state *mem_cgroup_css_from_page(struct page *page) | |||
434 | 434 | ||
435 | memcg = page->mem_cgroup; | 435 | memcg = page->mem_cgroup; |
436 | 436 | ||
437 | if (!memcg || !cgroup_on_dfl(memcg->css.cgroup)) | 437 | if (!memcg || !cgroup_subsys_on_dfl(memory_cgrp_subsys)) |
438 | memcg = root_mem_cgroup; | 438 | memcg = root_mem_cgroup; |
439 | 439 | ||
440 | rcu_read_unlock(); | 440 | rcu_read_unlock(); |
@@ -2926,7 +2926,7 @@ static int memcg_activate_kmem(struct mem_cgroup *memcg, | |||
2926 | * of course permitted. | 2926 | * of course permitted. |
2927 | */ | 2927 | */ |
2928 | mutex_lock(&memcg_create_mutex); | 2928 | mutex_lock(&memcg_create_mutex); |
2929 | if (cgroup_has_tasks(memcg->css.cgroup) || | 2929 | if (cgroup_is_populated(memcg->css.cgroup) || |
2930 | (memcg->use_hierarchy && memcg_has_children(memcg))) | 2930 | (memcg->use_hierarchy && memcg_has_children(memcg))) |
2931 | err = -EBUSY; | 2931 | err = -EBUSY; |
2932 | mutex_unlock(&memcg_create_mutex); | 2932 | mutex_unlock(&memcg_create_mutex); |
@@ -4066,8 +4066,7 @@ static struct cftype mem_cgroup_legacy_files[] = { | |||
4066 | { | 4066 | { |
4067 | .name = "cgroup.event_control", /* XXX: for compat */ | 4067 | .name = "cgroup.event_control", /* XXX: for compat */ |
4068 | .write = memcg_write_event_control, | 4068 | .write = memcg_write_event_control, |
4069 | .flags = CFTYPE_NO_PREFIX, | 4069 | .flags = CFTYPE_NO_PREFIX | CFTYPE_WORLD_WRITABLE, |
4070 | .mode = S_IWUGO, | ||
4071 | }, | 4070 | }, |
4072 | { | 4071 | { |
4073 | .name = "swappiness", | 4072 | .name = "swappiness", |
@@ -4834,7 +4833,7 @@ static int mem_cgroup_can_attach(struct cgroup_subsys_state *css, | |||
4834 | { | 4833 | { |
4835 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); | 4834 | struct mem_cgroup *memcg = mem_cgroup_from_css(css); |
4836 | struct mem_cgroup *from; | 4835 | struct mem_cgroup *from; |
4837 | struct task_struct *p; | 4836 | struct task_struct *leader, *p; |
4838 | struct mm_struct *mm; | 4837 | struct mm_struct *mm; |
4839 | unsigned long move_flags; | 4838 | unsigned long move_flags; |
4840 | int ret = 0; | 4839 | int ret = 0; |
@@ -4848,7 +4847,20 @@ static int mem_cgroup_can_attach(struct cgroup_subsys_state *css, | |||
4848 | if (!move_flags) | 4847 | if (!move_flags) |
4849 | return 0; | 4848 | return 0; |
4850 | 4849 | ||
4851 | p = cgroup_taskset_first(tset); | 4850 | /* |
4851 | * Multi-process migrations only happen on the default hierarchy | ||
4852 | * where charge immigration is not used. Perform charge | ||
4853 | * immigration if @tset contains a leader and whine if there are | ||
4854 | * multiple. | ||
4855 | */ | ||
4856 | p = NULL; | ||
4857 | cgroup_taskset_for_each_leader(leader, tset) { | ||
4858 | WARN_ON_ONCE(p); | ||
4859 | p = leader; | ||
4860 | } | ||
4861 | if (!p) | ||
4862 | return 0; | ||
4863 | |||
4852 | from = mem_cgroup_from_task(p); | 4864 | from = mem_cgroup_from_task(p); |
4853 | 4865 | ||
4854 | VM_BUG_ON(from == memcg); | 4866 | VM_BUG_ON(from == memcg); |
@@ -5064,7 +5076,7 @@ static void mem_cgroup_bind(struct cgroup_subsys_state *root_css) | |||
5064 | * guarantees that @root doesn't have any children, so turning it | 5076 | * guarantees that @root doesn't have any children, so turning it |
5065 | * on for the root memcg is enough. | 5077 | * on for the root memcg is enough. |
5066 | */ | 5078 | */ |
5067 | if (cgroup_on_dfl(root_css->cgroup)) | 5079 | if (cgroup_subsys_on_dfl(memory_cgrp_subsys)) |
5068 | root_mem_cgroup->use_hierarchy = true; | 5080 | root_mem_cgroup->use_hierarchy = true; |
5069 | else | 5081 | else |
5070 | root_mem_cgroup->use_hierarchy = false; | 5082 | root_mem_cgroup->use_hierarchy = false; |
@@ -5208,6 +5220,7 @@ static struct cftype memory_files[] = { | |||
5208 | { | 5220 | { |
5209 | .name = "events", | 5221 | .name = "events", |
5210 | .flags = CFTYPE_NOT_ON_ROOT, | 5222 | .flags = CFTYPE_NOT_ON_ROOT, |
5223 | .file_offset = offsetof(struct mem_cgroup, events_file), | ||
5211 | .seq_show = memory_events_show, | 5224 | .seq_show = memory_events_show, |
5212 | }, | 5225 | }, |
5213 | { } /* terminate */ | 5226 | { } /* terminate */ |