The patch titled Subject: mm: drain memcg stocks on css offlining has been added to the -mm tree. Its filename is mm-drain-memcg-stocks-on-css-offlining.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-drain-memcg-stocks-on-css-offlining.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-drain-memcg-stocks-on-css-offlining.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: Roman Gushchin <guro@xxxxxx> Subject: mm: drain memcg stocks on css offlining Memcg charge is batched using per-cpu stocks, so an offline memcg can be pinned by a cached charge up to a moment, when a process belonging to some other cgroup will charge some memory on the same cpu. In other words, cached charges can prevent a memory cgroup from being reclaimed for some time, without any clear need. Let's optimize it by explicit draining of all stocks on css offlining. As draining is performed asynchronously, and is skipped if any parallel draining is happening, it's cheap. Link: http://lkml.kernel.org/r/20180827162621.30187-2-guro@xxxxxx Signed-off-by: Roman Gushchin <guro@xxxxxx> Reviewed-by: Shakeel Butt <shakeelb@xxxxxxxxxx> Acked-by: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Konstantin Khlebnikov <koct9i@xxxxxxxxx> Cc: Tejun Heo <tj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 2 ++ 1 file changed, 2 insertions(+) --- a/mm/memcontrol.c~mm-drain-memcg-stocks-on-css-offlining +++ a/mm/memcontrol.c @@ -4573,6 +4573,8 @@ static void mem_cgroup_css_offline(struc memcg_offline_kmem(memcg); wb_memcg_offline(memcg); + drain_all_stock(memcg); + mem_cgroup_id_put(memcg); } _ Patches currently in -mm which might be from guro@xxxxxx are mm-rework-memcg-kernel-stack-accounting.patch mm-drain-memcg-stocks-on-css-offlining.patch mm-dont-miss-the-last-page-because-of-round-off-error.patch