The patch titled Subject: mm: memcontrol: drain stocks on resize limit has been added to the -mm tree. Its filename is mm-memcontrol-drain-stocks-on-resize-limit.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-memcontrol-drain-stocks-on-resize-limit.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-memcontrol-drain-stocks-on-resize-limit.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: Shakeel Butt <shakeelb@xxxxxxxxxx> Subject: mm: memcontrol: drain stocks on resize limit Resizing the memcg limit for cgroup-v2 drains the stocks before triggering the memcg reclaim. Do the same for cgroup-v1 to make the behavior consistent. Link: http://lkml.kernel.org/r/20180504205548.110696-1-shakeelb@xxxxxxxxxx Signed-off-by: Shakeel Butt <shakeelb@xxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Greg Thelen <gthelen@xxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Vladimir Davydov <vdavydov.dev@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memcontrol.c | 7 +++++++ 1 file changed, 7 insertions(+) diff -puN mm/memcontrol.c~mm-memcontrol-drain-stocks-on-resize-limit mm/memcontrol.c --- a/mm/memcontrol.c~mm-memcontrol-drain-stocks-on-resize-limit +++ a/mm/memcontrol.c @@ -2455,6 +2455,7 @@ static int mem_cgroup_resize_max(struct unsigned long max, bool memsw) { bool enlarge = false; + bool drained = false; int ret; bool limits_invariant; struct page_counter *counter = memsw ? &memcg->memsw : &memcg->memory; @@ -2485,6 +2486,12 @@ static int mem_cgroup_resize_max(struct if (!ret) break; + if (!drained) { + drain_all_stock(memcg); + drained = true; + continue; + } + if (!try_to_free_mem_cgroup_pages(memcg, 1, GFP_KERNEL, !memsw)) { ret = -EBUSY; _ Patches currently in -mm which might be from shakeelb@xxxxxxxxxx are mm-memcg-remote-memcg-charging-for-kmem-allocations.patch fs-fsnotify-account-fsnotify-metadata-to-kmemcg.patch mm-memcontrol-drain-stocks-on-resize-limit.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