The patch titled Subject: mm: memcontrol: decouple reference counting from page accounting fix has been added to the -mm tree. Its filename is mm-memcontrol-decouple-reference-counting-from-page-accounting-fix.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-memcontrol-decouple-reference-counting-from-page-accounting-fix.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-memcontrol-decouple-reference-counting-from-page-accounting-fix.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Hugh Dickins <hughd@xxxxxxxxxx> Subject: mm: memcontrol: decouple reference counting from page accounting fix Moving tasks between mem cgroups with memory.move_charge_at_immigrate 3, while swapping, crashes soon on mmotm (and so presumably on linux-next): for example, spinlock found corrupted when lock_page_memcg() is called. It's as if the mem cgroup structures have been freed too early. Stab in the dark: what if all the accounting is right, except that the css_put_many() in __mem_cgroup_clear_mc() is now (worse than) redundant? Removing it fixes the crashes, but that's hardly surprising; and stats temporarily hacked into mem_cgroup_css_alloc() and mem_cgroup_css_free() showed that mem cgroups were not being leaked with this change. Note: this removes the last call to css_put_many() from the tree; and mm-memcg-slab-use-a-single-set-of-kmem_caches-for-all-accounted-allocations.patch removes the last call to css_get_many(): now that their last references have gone, I expect them soon to be freed from include/linux/cgroup.h. Link: http://lkml.kernel.org/r/alpine.LSU.2.11.2007302011450.2347@eggly.anvils Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx> Acked-by: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Roman Gushchin <guro@xxxxxx> Cc: Roman Gushchin <guro@xxxxxx> Cc: Shakeel Butt <shakeelb@xxxxxxxxxx> Cc: Christoph Lameter <cl@xxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Cc: Vlastimil Babka <vbabka@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 2 -- 1 file changed, 2 deletions(-) --- a/mm/memcontrol.c~mm-memcontrol-decouple-reference-counting-from-page-accounting-fix +++ a/mm/memcontrol.c @@ -5680,8 +5680,6 @@ static void __mem_cgroup_clear_mc(void) if (!mem_cgroup_is_root(mc.to)) page_counter_uncharge(&mc.to->memory, mc.moved_swap); - css_put_many(&mc.to->css, mc.moved_swap); - mc.moved_swap = 0; } memcg_oom_recover(from); _ Patches currently in -mm which might be from hughd@xxxxxxxxxx are mm-memcontrol-decouple-reference-counting-from-page-accounting-fix.patch