The patch titled Subject: memcg: update the mm->memcg maintenance to work when !CONFIG_MMU has been removed from the -mm tree. Its filename was memcg-replace-mm-owner-with-mm-memcg-fix.patch This patch was dropped because it was folded into memcg-replace-mm-owner-with-mm-memcg.patch ------------------------------------------------------ From: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> Subject: memcg: update the mm->memcg maintenance to work when !CONFIG_MMU Michal Hocko <mhocko@xxxxxxxxxx> reported: > I am getting the following for nommu with MEMCG=y randconfig: > kernel/fork.o: In function `mm_init': > fork.c:(.text+0x948): undefined reference to `mm_update_memcg' > kernel/fork.o: In function `mmput': > fork.c:(.text+0x119c): undefined reference to `mm_update_memcg' > make: *** [vmlinux] Error 1 A memory control group that only accounts mm activity on page fault seems pointless when !MMU. Still I don't intend to break it so move the mm->memcg changes out of #ifndef MMU. Link: http://lkml.kernel.org/r/87lgczcox0.fsf_-_@xxxxxxxxxxxx Signed-off-by: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx> Reported-by: Michal Hocko <mhocko@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 109 +++++++++++++++++++++------------------------- 1 file changed, 51 insertions(+), 58 deletions(-) diff -puN mm/memcontrol.c~memcg-replace-mm-owner-with-mm-memcg-fix mm/memcontrol.c --- a/mm/memcontrol.c~memcg-replace-mm-owner-with-mm-memcg-fix +++ a/mm/memcontrol.c @@ -4869,59 +4869,6 @@ static int mem_cgroup_can_attach(struct return ret; } -/** - * mm_update_memcg - Update the memory cgroup of a mm_struct - * @mm: mm struct - * @new: new memory cgroup value - * - * Called whenever mm->memcg needs to change. Consumes a reference - * to new (unless new is NULL). The reference to the old memory - * cgroup is decreased. - */ -void mm_update_memcg(struct mm_struct *mm, struct mem_cgroup *new) -{ - /* This is the only place where mm->memcg is changed */ - struct mem_cgroup *old; - - old = xchg(&mm->memcg, new); - if (old) - css_put(&old->css); -} - -static void task_update_memcg(struct task_struct *tsk, struct mem_cgroup *new) -{ - struct mm_struct *mm; - task_lock(tsk); - mm = tsk->mm; - if (mm && !(tsk->flags & PF_KTHREAD)) - mm_update_memcg(mm, new); - task_unlock(tsk); -} - -static void mem_cgroup_attach(struct cgroup_taskset *tset) -{ - struct cgroup_subsys_state *css; - struct task_struct *tsk; - - cgroup_taskset_for_each(tsk, css, tset) { - struct mem_cgroup *new = mem_cgroup_from_css(css); - css_get(css); - task_update_memcg(tsk, new); - } -} - -static void mem_cgroup_fork(struct task_struct *tsk) -{ - struct cgroup_subsys_state *css; - - rcu_read_lock(); - css = task_css(tsk, memory_cgrp_id); - if (css && css_tryget(css)) - task_update_memcg(tsk, mem_cgroup_from_css(css)); - rcu_read_unlock(); -} - - static void mem_cgroup_cancel_attach(struct cgroup_taskset *tset) { if (mc.to) @@ -5090,19 +5037,65 @@ static int mem_cgroup_can_attach(struct { return 0; } -static void mem_cgroup_attach(struct cgroup_taskset *tset) +static void mem_cgroup_cancel_attach(struct cgroup_taskset *tset) { } -static void mem_cgroup_fork(struct task_struct *task) +static void mem_cgroup_move_task(void) { } -static void mem_cgroup_cancel_attach(struct cgroup_taskset *tset) +#endif + +/** + * mm_update_memcg - Update the memory cgroup of a mm_struct + * @mm: mm struct + * @new: new memory cgroup value + * + * Called whenever mm->memcg needs to change. Consumes a reference + * to new (unless new is NULL). The reference to the old memory + * cgroup is decreased. + */ +void mm_update_memcg(struct mm_struct *mm, struct mem_cgroup *new) { + /* This is the only place where mm->memcg is changed */ + struct mem_cgroup *old; + + old = xchg(&mm->memcg, new); + if (old) + css_put(&old->css); } -static void mem_cgroup_move_task(void) + +static void task_update_memcg(struct task_struct *tsk, struct mem_cgroup *new) +{ + struct mm_struct *mm; + task_lock(tsk); + mm = tsk->mm; + if (mm && !(tsk->flags & PF_KTHREAD)) + mm_update_memcg(mm, new); + task_unlock(tsk); +} + +static void mem_cgroup_attach(struct cgroup_taskset *tset) { + struct cgroup_subsys_state *css; + struct task_struct *tsk; + + cgroup_taskset_for_each(tsk, css, tset) { + struct mem_cgroup *new = mem_cgroup_from_css(css); + css_get(css); + task_update_memcg(tsk, new); + } +} + +static void mem_cgroup_fork(struct task_struct *tsk) +{ + struct cgroup_subsys_state *css; + + rcu_read_lock(); + css = task_css(tsk, memory_cgrp_id); + if (css && css_tryget(css)) + task_update_memcg(tsk, mem_cgroup_from_css(css)); + rcu_read_unlock(); } -#endif /* * Cgroup retains root cgroups across [un]mount cycles making it necessary _ Patches currently in -mm which might be from ebiederm@xxxxxxxxxxxx are memcg-replace-mm-owner-with-mm-memcg.patch memcg-replace-mm-owner-with-mm-memcg-fix-2.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html